/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    ap-northeast-1 = 'account-id.ap-northeast-1.fc.aliyuncs.com',
    ap-south-1 = 'account-id.ap-south-1.fc.aliyuncs.com',
    ap-southeast-1 = 'account-id.ap-southeast-1.fc.aliyuncs.com',
    ap-southeast-2 = 'account-id.ap-southeast-2.fc.aliyuncs.com',
    ap-southeast-3 = 'account-id.ap-southeast-3.fc.aliyuncs.com',
    ap-southeast-5 = 'account-id.ap-southeast-5.fc.aliyuncs.com',
    cn-beijing = 'account-id.cn-beijing.fc.aliyuncs.com',
    cn-chengdu = 'account-id.cn-chengdu.fc.aliyuncs.com',
    cn-hangzhou = 'account-id.cn-hangzhou.fc.aliyuncs.com',
    cn-hangzhou-finance = 'account-id.cn-hangzhou-finance.fc.aliyuncs.com',
    cn-hongkong = 'account-id.cn-hongkong.fc.aliyuncs.com',
    cn-huhehaote = 'account-id.cn-huhehaote.fc.aliyuncs.com',
    cn-north-2-gov-1 = 'account-id.cn-north-2-gov-1.fc.aliyuncs.com',
    cn-qingdao = 'account-id.cn-qingdao.fc.aliyuncs.com',
    cn-shanghai = 'account-id.cn-shanghai.fc.aliyuncs.com',
    cn-shenzhen = 'account-id.cn-shenzhen.fc.aliyuncs.com',
    cn-zhangjiakou = 'account-id.cn-zhangjiakou.fc.aliyuncs.com',
    eu-central-1 = 'account-id.eu-central-1.fc.aliyuncs.com',
    eu-west-1 = 'account-id.eu-west-1.fc.aliyuncs.com',
    us-east-1 = 'account-id.us-east-1.fc.aliyuncs.com',
    us-west-1 = 'account-id.us-west-1.fc.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('fc-open', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AccelerationInfo {
  status?: string(name='status', example='Preparing'),
}

model AsyncConfigMeta {
  functionName?: string(name='functionName', example='functionName'),
  qualifier?: string(name='qualifier', example='LATEST'),
  serviceName?: string(name='serviceName', example='serviceName'),
}

model AvailableAZ {
  availableAZs?: string(name='availableAZs'),
}

model BatchWindow {
  countBasedWindow?: long(name='CountBasedWindow'),
  timeBasedWindow?: long(name='TimeBasedWindow'),
}

model CDNEventsTriggerConfig {
  eventName?: string(name='eventName'),
  eventVersion?: string(name='eventVersion'),
  filter?: map[string][ string ](name='filter'),
  notes?: string(name='notes'),
}

model CertConfig {
  certName?: string(name='certName'),
  certificate?: string(name='certificate', example='-----BEGIN CERTIFICATE----- xxxxx -----END CERTIFICATE-----'),
  privateKey?: string(name='privateKey', example='-----BEGIN RSA PRIVATE KEY----- xxxxx -----END RSA PRIVATE KEY-----'),
}

model Code {
  ossBucketName?: string(name='ossBucketName', example='demo-bucket'),
  ossObjectName?: string(name='ossObjectName', example='demo-key'),
  zipFile?: string(name='zipFile', example='UEsDBAoAAAAAANFUiFYAAAAAAAAAAAAAAAAFABwAY29kZS9VVAkAA6rTMGSq0zBk dXgLAAEE9gEAAAQUAAAAUEsDBBQAAAAIANFUiFaigyIV4wEAAM4DAAANABwAY29k ZS9pbmRleC5qc1VUCQADqtMwZKvTMGR1eAsAAQT2AQAABBQAAAB1k81u1DAQx+9+ irnFqVJHHCioq+UAEqIcALXlhBByktmNqWOntrPbgPZF+iy8E6+AvfYmUYFc4vH/ NzOZj+y4gS26a75/rZsR1mDwfhAGaWb4/rzyd1m+IrtIvdWme4oFpNx44cRV/wCC Rkh5Rm41oOKVRHAtglDCCS7FDzSwQe4Gg0Bb53p7WZYtyp55cRwUq3VXNroeOlTu W4OOC1k+e37x8sUFa10nc9JL5NYH7PwhQH+HH1TthFbALVQo9f73r0eCD702zrIl uAZaa+XwwRVQcykrXt/lsH4FPwmAV6yWyKTe0mzyEmobCoSJp2qQsoAs3B5W5Kwk U6qWq0bGNL5DhW+T7QtIGac8TzL5VkgNe21kc+xkAEKre254Z32s6BOenrv2MjSf hVMx3d8PaATaKCVjVlvkDZqkJmNWO3StbiCq0ZjFMGe07vP1VQIGI2e1lsJP4+pT 0k5mBA6xknn9YktOo6JoTHFcp3xRoF81oKH4Oxz9hJf1LLHYoB2XA8ZlPEFfvN/X 1YILE2AW3btj2dTLRfTLZ+pA/kNnb8LklDu/HXvM/Mh530tR8/D95XerVbaIEsfF 0g8SXszpG2f8/tAFllKohr6/+fiB2SMgNiON/gWk7QpslifHQ1g18gdQSwECHgMK AAAAAADRVIhWAAAAAAAAAAAAAAAABQAYAAAAAAAAABAA7UEAAAAAY29kZS9VVAUA A6rTMGR1eAsAAQT2AQAABBQAAABQSwECHgMUAAAACADRVIhWooMiFeMBAADOAwAA DQAYAAAAAAABAAAApIE/AAAAY29kZS9pbmRleC5qc1VUBQADqtMwZHV4CwABBPYB AAAEFAAAAFBLBQYAAAAAAgACAJ4AAABpAgAAAAA='),
}

model CustomContainerConfig {
  accelerationType?: string(name='accelerationType', example='Default'),
  args?: string(name='args', example='["-arg1", "value1"]'),
  command?: string(name='command', example='["/code/myserver"]'),
  image?: string(name='image', example='registry-vpc.cn-hangzhou.aliyuncs.com/fc-demo/helloworld:v1beta1'),
  instanceID?: string(name='instanceID', example='cri-xxxxxxxxxx'),
  webServerMode?: boolean(name='webServerMode', example='true'),
}

model CustomContainerConfigInfo {
  accelerationInfo?: AccelerationInfo(name='accelerationInfo'),
  accelerationType?: string(name='accelerationType', example='Default'),
  args?: string(name='args', example='["-arg1", "value1"]'),
  command?: string(name='command', example='["/code/myserver"]'),
  image?: string(name='image', example='registry-vpc.cn-hangzhou.aliyuncs.com/fc-demo/helloworld:v1beta1'),
  instanceID?: string(name='instanceID', example='cri-xxxxxxxxxx'),
  webServerMode?: boolean(name='webServerMode', example='true'),
}

model CustomDNS {
  dnsOptions?: [
    DNSOption
  ](name='dnsOptions'),
  nameServers?: [ string ](name='nameServers'),
  searches?: [ string ](name='searches'),
}

model CustomHealthCheckConfig {
  failureThreshold?: int32(name='failureThreshold'),
  httpGetUrl?: string(name='httpGetUrl'),
  initialDelaySeconds?: int32(name='initialDelaySeconds'),
  periodSeconds?: int32(name='periodSeconds'),
  successThreshold?: int32(name='successThreshold'),
  timeoutSeconds?: int32(name='timeoutSeconds'),
}

model CustomRuntimeConfig {
  args?: [ string ](name='args'),
  command?: [ string ](name='command'),
}

model DNSOption {
  name?: string(name='name', example='ndots'),
  value?: string(name='value', example='2'),
}

model DeadLetterQueue {
  arn?: string(name='Arn'),
}

model DeliveryOption {
  concurrency?: long(name='concurrency'),
  eventSchema?: string(name='eventSchema'),
  mode?: string(name='mode'),
}

model Destination {
  destination?: string(name='destination'),
}

model DestinationConfig {
  onFailure?: Destination(name='onFailure'),
  onSuccess?: Destination(name='onSuccess'),
}

model Error {
  errorCode?: string(name='errorCode'),
  errorMessage?: string(name='errorMessage'),
}

model ErrorInfo {
  errorMessage?: string(name='errorMessage'),
  stackTrace?: string(name='stackTrace'),
}

model EventBridgeTriggerConfig {
  asyncInvocationType?: boolean(name='asyncInvocationType'),
  eventRuleFilterPattern?: string(name='eventRuleFilterPattern'),
  eventSinkConfig?: EventSinkConfig(name='eventSinkConfig'),
  eventSourceConfig?: EventSourceConfig(name='eventSourceConfig'),
  runOptions?: RunOptions(name='runOptions'),
  triggerEnable?: boolean(name='triggerEnable'),
}

model EventSinkConfig {
  deliveryOption?: DeliveryOption(name='deliveryOption'),
}

model EventSourceConfig {
  eventSourceParameters?: EventSourceParameters(name='eventSourceParameters'),
  eventSourceType?: string(name='eventSourceType'),
}

model EventSourceParameters {
  sourceDTSParameters?: SourceDTSParameters(name='sourceDTSParameters'),
  sourceKafkaParameters?: SourceKafkaParameters(name='sourceKafkaParameters'),
  sourceMNSParameters?: SourceMNSParameters(name='sourceMNSParameters'),
  sourceMQTTParameters?: SourceMQTTParameters(name='sourceMQTTParameters'),
  sourceRabbitMQParameters?: SourceRabbitMQParameters(name='sourceRabbitMQParameters'),
  sourceRocketMQParameters?: SourceRocketMQParameters(name='sourceRocketMQParameters'),
}

model HTTPTriggerConfig {
  authConfig?: string(name='authConfig'),
  authType?: string(name='authType', example='anonymous, function, jwt'),
  disableURLInternet?: boolean(name='disableURLInternet', description='禁用默认公网域名访问的开关，设置为true 时，访问函数默认提供的公网URL地址会返回403错误。设置为 false 则不会有任何影响。'),
  methods?: [ string ](name='methods'),
}

model InstanceLifecycleConfig {
  preFreeze?: LifecycleHook(name='preFreeze'),
  preStop?: LifecycleHook(name='preStop'),
}

model JWTAuthConfig {
  blackList?: string(name='blackList', example='/userInfo/*'),
  claimPassBy?: [ string ](name='claimPassBy', example='header:userID:userIDToFunction'),
  jwks?: string(name='jwks'),
  tokenLookup?: [ string ](name='tokenLookup'),
  whiteList?: [ string ](name='whiteList'),
}

model JaegerConfig {
  endpoint?: string(name='endpoint'),
}

model JobConfig {
  maxRetryTime?: long(name='maxRetryTime'),
  triggerInterval?: long(name='triggerInterval'),
}

model JobLogConfig {
  logstore?: string(name='logstore'),
  project?: string(name='project'),
}

model Layer {
  acl?: int32(name='acl'),
  arn?: string(name='arn'),
  arnV2?: string(name='arnV2'),
  code?: LayerCode(name='code'),
  codeChecksum?: string(name='codeChecksum'),
  codeSize?: long(name='codeSize'),
  compatibleRuntime?: [ string ](name='compatibleRuntime'),
  createTime?: string(name='createTime'),
  description?: string(name='description'),
  layerName?: string(name='layerName'),
  license?: string(name='license'),
  version?: int32(name='version'),
}

model LayerCode {
  location?: string(name='location', example='仅在查询具体层版本时返回'),
  repositoryType?: string(name='repositoryType'),
}

model LifecycleHook {
  handler?: string(name='handler'),
  timeout?: int32(name='timeout'),
}

model LogConfig {
  enableInstanceMetrics?: boolean(name='enableInstanceMetrics', example='true'),
  enableRequestMetrics?: boolean(name='enableRequestMetrics', example='true'),
  logBeginRule?: string(name='logBeginRule', example='DefaultRegex'),
  logstore?: string(name='logstore', example='test-prj'),
  project?: string(name='project', example='test-logstore'),
}

model LogTriggerConfig {
  enable?: boolean(name='enable'),
  functionParameter?: map[string]string(name='functionParameter'),
  jobConfig?: JobConfig(name='jobConfig'),
  logConfig?: JobLogConfig(name='logConfig'),
  sourceConfig?: SourceConfig(name='sourceConfig'),
}

model MeteringConfig {
  logConfig?: LogConfig(name='logConfig'),
  payerId?: string(name='payerId'),
  role?: string(name='role'),
}

model MnsTopicTriggerConfig {
  filterTag?: string(name='filterTag'),
  notifyContentFormat?: string(name='notifyContentFormat'),
  notifyStrategy?: string(name='notifyStrategy'),
}

model NASConfig {
  groupId?: int32(name='groupId', example='100'),
  mountPoints?: [ 
    {
      enableTLS?: boolean(name='enableTLS', example='false'),
      mountDir?: string(name='mountDir', example='/home/test'),
      serverAddr?: string(name='serverAddr', example='***-uni85.cn-hangzhou.nas.aliyuncs.com:/'),
    }
  ](name='mountPoints'),
  userId?: int32(name='userId', example='100'),
}

model OSSMountConfig {
  mountPoints?: [ 
    {
      bucketName?: string(name='bucketName', example='my-bucket'),
      bucketPath?: string(name='bucketPath', example='/my-dir'),
      endpoint?: string(name='endpoint', example='http://oss-cn-shanghai.aliyuncs.com'),
      mountDir?: string(name='mountDir', example='/mnt/dir'),
      readOnly?: boolean(name='readOnly', example='true'),
    }
  ](name='mountPoints'),
}

model OSSTriggerConfig {
  events?: [ string ](name='events'),
  filter?: OSSTriggerFilter(name='filter'),
}

model OSSTriggerFilter {
  key?: OSSTriggerKey(name='key'),
}

model OSSTriggerKey {
  prefix?: string(name='prefix'),
  suffix?: string(name='suffix'),
}

model OnDemandConfig {
  maximumInstanceCount?: long(name='maximumInstanceCount', example='10'),
  resource?: string(name='resource', example='services/serviceName/function/functionName'),
}

model OpenReservedCapacity {
  createdTime?: string(name='createdTime'),
  cu?: long(name='cu'),
  deadline?: string(name='deadline'),
  instanceId?: string(name='instanceId'),
  isRefunded?: string(name='isRefunded'),
  lastModifiedTime?: string(name='lastModifiedTime'),
}

model OutputCodeLocation {
  location?: string(name='location'),
  repositoryType?: string(name='repositoryType'),
}

model PathConfig {
  functionName?: string(name='functionName', example='f1'),
  methods?: [ string ](name='methods'),
  path?: string(name='path', example='/login'),
  qualifier?: string(name='qualifier', example='prod'),
  rewriteConfig?: RewriteConfig(name='rewriteConfig'),
  serviceName?: string(name='serviceName', example='s1'),
}

model PolicyItem {
  key?: string(name='key', example='x-test-uid'),
  operator?: string(name='operator', example='='),
  type?: string(name='type', example='Header'),
  value?: string(name='value', example='11111'),
}

model PreFreeze {
  handler?: string(name='handler', example='index.preFreeze'),
  timeout?: int32(name='timeout', example='10'),
}

model PreStop {
  handler?: string(name='handler', example='index.PreStop'),
  timeout?: int32(name='timeout', example='10'),
}

model RdsTriggerConfig {
  concurrency?: long(name='concurrency'),
  eventFormat?: string(name='eventFormat'),
  retry?: long(name='retry'),
  subscriptionObjects?: [ string ](name='subscriptionObjects'),
}

model Resource {
  resourceArn?: string(name='resourceArn'),
  tags?: map[string]string(name='tags'),
}

model RetryStrategy {
  maximumEventAgeInSeconds?: long(name='MaximumEventAgeInSeconds'),
  maximumRetryAttempts?: long(name='MaximumRetryAttempts'),
  pushRetryStrategy?: string(name='PushRetryStrategy'),
}

model RewriteConfig {
  equalRules?: [ 
    {
      match?: string(name='match', example='/old'),
      replacement?: string(name='replacement', example='/new'),
    }
  ](name='equalRules'),
  regexRules?: [ 
    {
      match?: string(name='match', example='^/js/(.*?)$'),
      replacement?: string(name='replacement', example='/public/javascripts/$1'),
    }
  ](name='regexRules'),
  wildcardRules?: [ 
    {
      match?: string(name='match', example='/api/*'),
      replacement?: string(name='replacement', example='/$1'),
    }
  ](name='wildcardRules'),
}

model RouteConfig {
  routes?: [
    PathConfig
  ](name='routes'),
}

model RoutePolicy {
  condition?: string(name='condition', example='AND'),
  policyItems?: [
    PolicyItem
  ](name='policyItems'),
}

model RunOptions {
  batchWindow?: BatchWindow(name='batchWindow'),
  deadLetterQueue?: DeadLetterQueue(name='deadLetterQueue'),
  errorsTolerance?: string(name='errorsTolerance'),
  maximumTasks?: long(name='maximumTasks'),
  mode?: string(name='mode'),
  retryStrategy?: RetryStrategy(name='retryStrategy'),
}

model ScheduledActions {
  endTime?: string(name='endTime'),
  name?: string(name='name'),
  scheduleExpression?: string(name='scheduleExpression'),
  startTime?: string(name='startTime'),
  target?: long(name='target'),
}

model SourceConfig {
  logstore?: string(name='logstore'),
}

model SourceDTSParameters {
  brokerUrl?: string(name='BrokerUrl', example='dts-cn-shanghai-vpc.aliyuncs.com:18003'),
  initCheckPoint?: long(name='InitCheckPoint', example='1677340805'),
  password?: string(name='Password', example='dtsTest123'),
  regionId?: string(name='RegionId', example='cn-shanghai'),
  sid?: string(name='Sid', example='dtse34j22j025aq26p'),
  taskId?: string(name='TaskId', example='e34z2gm325qp37m'),
  topic?: string(name='Topic', example='cn_shanghai_vpc_rm_uf6398ykj0218rk6t_dts_trigger_upgrade_from_old_version2'),
  username?: string(name='Username', example='dts_trigger'),
}

model SourceKafkaParameters {
  consumerGroup?: string(name='ConsumerGroup'),
  instanceId?: string(name='InstanceId'),
  network?: string(name='Network'),
  offsetReset?: string(name='OffsetReset'),
  regionId?: string(name='RegionId', example='cn-hangzhou'),
  securityGroupId?: string(name='SecurityGroupId'),
  topic?: string(name='Topic'),
  vSwitchIds?: string(name='VSwitchIds'),
  vpcId?: string(name='VpcId'),
}

model SourceMNSParameters {
  isBase64Decode?: boolean(name='IsBase64Decode'),
  queueName?: string(name='QueueName'),
  regionId?: string(name='RegionId'),
}

model SourceMQTTParameters {
  instanceId?: string(name='InstanceId'),
  regionId?: string(name='RegionId', example='cn-shanghai'),
  topic?: string(name='Topic'),
}

model SourceRabbitMQParameters {
  instanceId?: string(name='InstanceId'),
  queueName?: string(name='QueueName'),
  regionId?: string(name='RegionId'),
  virtualHostName?: string(name='VirtualHostName'),
}

model SourceRocketMQParameters {
  authType?: string(name='AuthType'),
  filterSql?: string(name='FilterSql'),
  filterType?: string(name='FilterType'),
  groupID?: string(name='GroupID'),
  instanceEndpoint?: string(name='InstanceEndpoint'),
  instanceId?: string(name='InstanceId'),
  instanceNetwork?: string(name='InstanceNetwork', example='PrivateNetwork'),
  instancePassword?: string(name='InstancePassword'),
  instanceSecurityGroupId?: string(name='InstanceSecurityGroupId'),
  instanceType?: string(name='InstanceType', example='Cloud_5'),
  instanceUsername?: string(name='InstanceUsername'),
  instanceVSwitchIds?: string(name='InstanceVSwitchIds'),
  instanceVpcId?: string(name='InstanceVpcId'),
  offset?: string(name='Offset', example='CONSUME_FROM_LAST_OFFSET'),
  regionId?: string(name='RegionId'),
  tag?: string(name='Tag'),
  timestamp?: long(name='Timestamp'),
  topic?: string(name='Topic'),
}

model StatefulAsyncInvocation {
  alreadyRetriedTimes?: long(name='alreadyRetriedTimes', example='3'),
  destinationStatus?: string(name='destinationStatus', example='Succeeded'),
  durationMs?: long(name='durationMs', example='100'),
  endTime?: long(name='endTime', example='1633449599'),
  events?: [
    StatefulAsyncInvocationEvent
  ](name='events'),
  functionName?: string(name='functionName', example='functionName'),
  instanceId?: string(name='instanceId', example='D4-4BA6-5293-9FD1-882707E'),
  invocationErrorMessage?: string(name='invocationErrorMessage', example='UnhandledInvocationError'),
  invocationId?: string(name='invocationId', example='cxxdfd'),
  invocationPayload?: string(name='invocationPayload', example='{"key1":"value1","key2":"value2"}'),
  qualifier?: string(name='qualifier', example='LATEST'),
  requestId?: string(name='requestId', example='ABA740D4-4BA6-5293-9FD1-882707EADC37'),
  returnPayload?: string(name='returnPayload', example='my-result'),
  serviceName?: string(name='serviceName', example='serviceName'),
  startedTime?: long(name='startedTime', example='1633449590'),
  status?: string(name='status', example='Running'),
}

model StatefulAsyncInvocationEvent {
  eventDetail?: string(name='eventDetail', example='{"Error":"UnhandledInvocationError"}'),
  eventId?: long(name='eventId', example='1'),
  status?: string(name='status', example='Enqueued'),
  timestamp?: long(name='timestamp', example='1647420449721'),
}

model TLSConfig {
  cipherSuites?: [ string ](name='cipherSuites'),
  maxVersion?: string(name='maxVersion', example='TLSv1.3'),
  minVersion?: string(name='minVersion', example='TLSv1.0'),
}

model TargetTrackingPolicies {
  endTime?: string(name='endTime'),
  maxCapacity?: long(name='maxCapacity'),
  metricTarget?: double(name='metricTarget'),
  metricType?: string(name='metricType'),
  minCapacity?: long(name='minCapacity'),
  name?: string(name='name'),
  startTime?: string(name='startTime'),
}

model TimeTriggerConfig {
  cronExpression?: string(name='cronExpression'),
  enable?: boolean(name='enable'),
  payload?: string(name='payload'),
}

model TracingConfig {
  params?: map[string]string(name='params'),
  type?: string(name='type', example='Jaeger'),
}

model Trigger {
  createdTime?: string(name='createdTime'),
  domainName?: string(name='domainName'),
  invocationRole?: string(name='invocationRole'),
  lastModifiedTime?: string(name='lastModifiedTime'),
  qualifier?: string(name='qualifier'),
  sourceArn?: string(name='sourceArn'),
  status?: string(name='status'),
  targetArn?: string(name='targetArn'),
  triggerConfig?: string(name='triggerConfig'),
  triggerId?: string(name='triggerId'),
  triggerName?: string(name='triggerName', example='abc'),
  triggerType?: string(name='triggerType'),
  urlInternet?: string(name='urlInternet'),
  urlIntranet?: string(name='urlIntranet'),
}

model VPCConfig {
  role?: string(name='role'),
  securityGroupId?: string(name='securityGroupId', example='sg-bp18hj1wtxgy3b0***'),
  vSwitchIds?: [ string ](name='vSwitchIds'),
  vpcId?: string(name='vpcId', example='vpc-***'),
}

model VendorConfig {
  meteringConfig?: MeteringConfig(name='meteringConfig'),
}

model WAFConfig {
  enableWAF?: boolean(name='enableWAF'),
}

model ClaimGPUInstanceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='test-trace-id'),
}

model ClaimGPUInstanceRequest {
  diskPerformanceLevel?: string(name='diskPerformanceLevel', description='The disk performance level of the GPU rendering instance.', example='PL0'),
  diskSizeGigabytes?: string(name='diskSizeGigabytes', description='The system disk space of the GPU rendering instance. Unit: GB.', example='100'),
  imageId?: string(name='imageId', description='The image ID of the GPU rendering instance.', example='m-foobar'),
  instanceType?: string(name='instanceType', description='The specifications of the GPU rendering instance.', example='ecs.gn7i-c8g1.2xlarge'),
  internetBandwidthOut?: string(name='internetBandwidthOut', description='The outbound Internet bandwidth of the GPU rendering instance.', example='100'),
  password?: string(name='password', description='The password of the GPU rendering instance.', example='MyPassword'),
  role?: string(name='role', description='The role of the user.', example='acs:ram::1234567890:role/fc-test'),
  sgId?: string(name='sgId', description='The ID of the security group.', example='sg-xxxx'),
  sourceCidrIp?: string(name='sourceCidrIp', description='The source IPv4 CIDR block of the GPU rendering instance.', example='0.0.0.0/0'),
  tcpPortRange?: [ string ](name='tcpPortRange', description='The range of TCP ports that are enabled by the security group of the GPU rendering instance.'),
  udpPortRange?: [ string ](name='udpPortRange', description='The range of UDP ports that are enabled by the security group of the GPU rendering instance.'),
  vpcId?: string(name='vpcId', description='The virtual private cloud (VPC) ID.', example='v-xxxx'),
  vswId?: string(name='vswId', description='The vSwitch ID.', example='vsw-xxxx'),
}

model ClaimGPUInstanceResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the product instance is created.', example='2022-11-11 07:31:04.899465017 +0000 UTC m=+37.671563424'),
  instanceId?: string(name='instanceId', description='The ID of the instance that you query.', example='i-xxx'),
  publicIp?: string(name='publicIp', description='The public IP address of the server.', example='0.0.0.0'),
}

model ClaimGPUInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ClaimGPUInstanceResponseBody(name='body'),
}

async function claimGPUInstanceWithOptions(request: ClaimGPUInstanceRequest, headers: ClaimGPUInstanceHeaders, runtime: Util.RuntimeOptions): ClaimGPUInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.diskPerformanceLevel)) {
    body['diskPerformanceLevel'] = request.diskPerformanceLevel;
  }
  if (!Util.isUnset(request.diskSizeGigabytes)) {
    body['diskSizeGigabytes'] = request.diskSizeGigabytes;
  }
  if (!Util.isUnset(request.imageId)) {
    body['imageId'] = request.imageId;
  }
  if (!Util.isUnset(request.instanceType)) {
    body['instanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.internetBandwidthOut)) {
    body['internetBandwidthOut'] = request.internetBandwidthOut;
  }
  if (!Util.isUnset(request.password)) {
    body['password'] = request.password;
  }
  if (!Util.isUnset(request.role)) {
    body['role'] = request.role;
  }
  if (!Util.isUnset(request.sgId)) {
    body['sgId'] = request.sgId;
  }
  if (!Util.isUnset(request.sourceCidrIp)) {
    body['sourceCidrIp'] = request.sourceCidrIp;
  }
  if (!Util.isUnset(request.tcpPortRange)) {
    body['tcpPortRange'] = request.tcpPortRange;
  }
  if (!Util.isUnset(request.udpPortRange)) {
    body['udpPortRange'] = request.udpPortRange;
  }
  if (!Util.isUnset(request.vpcId)) {
    body['vpcId'] = request.vpcId;
  }
  if (!Util.isUnset(request.vswId)) {
    body['vswId'] = request.vswId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ClaimGPUInstance',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/gpuInstances`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function claimGPUInstance(request: ClaimGPUInstanceRequest): ClaimGPUInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ClaimGPUInstanceHeaders{};
  return claimGPUInstanceWithOptions(request, headers, runtime);
}

model CreateAliasHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='r9s89isisi****'),
}

model CreateAliasRequest {
  additionalVersionWeight?: map[string]float(name='additionalVersionWeight', description='The canary release version to which the alias points and the weight of the canary release version.

*   The canary release version takes effect only when the function is invoked.
*   The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.'),
  aliasName?: string(name='aliasName', description='The name of the alias. The name can contain letters, digits, underscores (\\_), and hyphens (-) only. The name cannot start with a digit or a hyphen (-). The name must be 1 to 128 characters in length. The name cannot be set to **LATEST**', example='alias_test'),
  description?: string(name='description', description='The description of the alias.', example='test_description'),
  resolvePolicy?: string(name='resolvePolicy', description='The canary release mode. Default values: off. Valid values:

*   **Random**: random canary release.
*   **Content**: rule-based canary release. By default, this parameter is empty.', example='Random'),
  routePolicy?: RoutePolicy(name='routePolicy', description='The canary release rule. Traffic that meets the canary release rule is routed to the canary release instance.'),
  versionId?: string(name='versionId', description='The ID of the version to which the alias points.', example='1'),
}

model CreateAliasResponseBody = {
  additionalVersionWeight?: map[string]float(name='additionalVersionWeight', description='The additional version to which the alias points and the weight of the additional version.

*   The additional version takes effect only when the function is invoked.
*   The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.'),
  aliasName?: string(name='aliasName', description='The name of the alias.', example='alias_test'),
  createdTime?: string(name='createdTime', description='The time when the alias was created.', example='2020-04-23T06:32:43Z'),
  description?: string(name='description', description='The description of the alias.', example='test_description'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the alias was last modified.', example='2020-04-23T06:32:43Z'),
  resolvePolicy?: string(name='resolvePolicy'),
  routePolicy?: RoutePolicy(name='routePolicy'),
  versionId?: string(name='versionId', description='The ID of the version to which the alias points.', example='1'),
}

model CreateAliasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAliasResponseBody(name='body'),
}

async function createAliasWithOptions(serviceName: string, request: CreateAliasRequest, headers: CreateAliasHeaders, runtime: Util.RuntimeOptions): CreateAliasResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.additionalVersionWeight)) {
    body['additionalVersionWeight'] = request.additionalVersionWeight;
  }
  if (!Util.isUnset(request.aliasName)) {
    body['aliasName'] = request.aliasName;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.resolvePolicy)) {
    body['resolvePolicy'] = request.resolvePolicy;
  }
  if (!Util.isUnset(request.routePolicy)) {
    body['routePolicy'] = request.routePolicy;
  }
  if (!Util.isUnset(request.versionId)) {
    body['versionId'] = request.versionId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAlias',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/aliases`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAlias(serviceName: string, request: CreateAliasRequest): CreateAliasResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateAliasHeaders{};
  return createAliasWithOptions(serviceName, request, headers, runtime);
}

model CreateCustomDomainHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the operation is called. The format is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='rid281s******'),
}

model CreateCustomDomainRequest {
  certConfig?: CertConfig(name='certConfig', description='The configurations of the HTTPS certificate.'),
  domainName?: string(name='domainName', description='The domain name. Enter a custom domain name that has obtained an ICP filing in the Alibaba Cloud ICP Filing system, or a custom domain name whose ICP filing information includes Alibaba Cloud as a service provider.', example='example.com'),
  protocol?: string(name='protocol', description='The protocol types supported by the domain name. Valid values:

*   **HTTP**: Only HTTP is supported.
*   **HTTPS**: Only HTTPS is supported.
*   **HTTP,HTTPS**: HTTP and HTTPS are supported.', example='HTTP'),
  routeConfig?: RouteConfig(name='routeConfig', description='The route table that maps the paths to functions when the functions are invoked by using the custom domain name.'),
  tlsConfig?: TLSConfig(name='tlsConfig', description='The Transport Layer Security (TLS) configuration.'),
  wafConfig?: WAFConfig(name='wafConfig', description='The Web Application Firewall (WAF) configuration.'),
}

model CreateCustomDomainResponseBody = {
  accountId?: string(name='accountId', description='The ID of your Alibaba Cloud account.', example='1986114****4305'),
  apiVersion?: string(name='apiVersion', description='The version of the API.', example='2016-08-15'),
  certConfig?: CertConfig(name='certConfig', description='The configurations of the HTTPS certificate.'),
  createdTime?: string(name='createdTime', description='The time when the domain name was added.', example='2020-07-27T08:02:19Z'),
  domainName?: string(name='domainName', description='The domain name.', example='example.com'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the domain name was last modified.', example='2020-07-27T08:02:19Z'),
  protocol?: string(name='protocol', description='The protocol types supported by the domain name. Valid values:

*   **HTTP**: Only HTTP is supported.
*   **HTTPS**: Only HTTPS is supported.
*   **HTTP,HTTPS**: HTTP and HTTPS are supported.', example='HTTP'),
  routeConfig?: RouteConfig(name='routeConfig', description='The route table that maps the paths to functions when the functions are invoked by using the custom domain name.'),
  tlsConfig?: TLSConfig(name='tlsConfig', description='The Transport Layer Security (TLS) configuration.'),
  wafConfig?: WAFConfig(name='wafConfig', description='The Web Application Firewall (WAF) configuration.'),
}

model CreateCustomDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCustomDomainResponseBody(name='body'),
}

async function createCustomDomainWithOptions(request: CreateCustomDomainRequest, headers: CreateCustomDomainHeaders, runtime: Util.RuntimeOptions): CreateCustomDomainResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.certConfig)) {
    body['certConfig'] = request.certConfig;
  }
  if (!Util.isUnset(request.domainName)) {
    body['domainName'] = request.domainName;
  }
  if (!Util.isUnset(request.protocol)) {
    body['protocol'] = request.protocol;
  }
  if (!Util.isUnset(request.routeConfig)) {
    body['routeConfig'] = request.routeConfig;
  }
  if (!Util.isUnset(request.tlsConfig)) {
    body['tlsConfig'] = request.tlsConfig;
  }
  if (!Util.isUnset(request.wafConfig)) {
    body['wafConfig'] = request.wafConfig;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateCustomDomain',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/custom-domains`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createCustomDomain(request: CreateCustomDomainRequest): CreateCustomDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateCustomDomainHeaders{};
  return createCustomDomainWithOptions(request, headers, runtime);
}

model CreateFunctionHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcCodeChecksum?: string(name='X-Fc-Code-Checksum', description='The CRC-64 value of the function code package.', example='1506052139770049xxxx'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request. The value is the same as that of the requestId parameter in the response.', example='test-trace-id'),
}

model CreateFunctionRequest {
  caPort?: int32(name='caPort', description='The port on which the HTTP server listens for the custom runtime or Custom Container runtime.', example='9000'),
  code?: Code(name='code', description='The ZIP package of function code. Set the value to **code** or **customContainerConfig**.'),
  cpu?: float(name='cpu', description='The CPU size of the function. Unit: vCPUs. The value is a multiple of 0.05 vCPUs.', example='1.5'),
  customContainerConfig?: CustomContainerConfig(name='customContainerConfig', description='The configuration of the Custom Container runtime. After you configure the Custom Container runtime, Function Compute can run the function in a container created from a custom image. Set the value to **code** or **customContainerConfig**.'),
  customDNS?: CustomDNS(name='customDNS', description='The custom Domain Name System (DNS) settings of the function.'),
  customHealthCheckConfig?: CustomHealthCheckConfig(name='customHealthCheckConfig', description='The custom health check configurations of the function. This parameter is applicable only to custom runtimes and Custom Container runtimes.'),
  customRuntimeConfig?: CustomRuntimeConfig(name='customRuntimeConfig', description='The configurations of the function that runs in the custom runtime.'),
  description?: string(name='description', description='The description of the function.', example='function-description'),
  diskSize?: int32(name='diskSize', description='The disk size of the function. Unit: MB. Valid values: 512 MB and 10240 MB.', example='512'),
  environmentVariables?: map[string]string(name='environmentVariables', description='The environment variables that you configured for the function. You can obtain the values of the environment variables from the function. For more information, see [Environment variables](~~69777~~).'),
  functionName?: string(name='functionName', description='The name of the function. It can contain letters, digits, underscores (\\_), and hyphens (-). It cannot start with a digit or hyphen (-). It must be 1 to 64 characters in length.', example='functionName'),
  gpuMemorySize?: int32(name='gpuMemorySize', description='The GPU memory size of the function. Unit: MB, which is a multiple of 1024MB.', example='2048'),
  handler?: string(name='handler', description='The handler of the function. The format varies based on the programming language. For more information, see [Function handlers](~~157704~~).', example='index.handler'),
  initializationTimeout?: int32(name='initializationTimeout', description='The timeout period for the Initializer hook. Default value: 3. Unit: seconds. The value of this parameter ranges from 1 to 300. When this period expires, the execution of the Initializer hook is terminated.', example='60'),
  initializer?: string(name='initializer', description='The handler of the Initializer hook. For more information, see [Initializer hooks](~~157704~~).', example='index.initializer'),
  instanceConcurrency?: int32(name='instanceConcurrency', description='The number of requests that can be concurrently processed by a single instance.', example='10'),
  instanceLifecycleConfig?: InstanceLifecycleConfig(name='instanceLifecycleConfig', description='The lifecycle configurations of instances.'),
  instanceSoftConcurrency?: int32(name='instanceSoftConcurrency', description='The soft concurrency of the instance. You can use this property to implement graceful scale-ups for instances. If the number of concurrent requests on an instance is greater than the value of soft concurrency, an instance scale out is triggered. For example, if your instance requires a long time to start, you can specify a proper soft concurrency to start the instance in advance.

The value must be less than or equal to that of **instanceConcurrency**.', example='5'),
  instanceType?: string(name='instanceType', description='The instance type of the function. Valid values:

*   **e1**: elastic instance
*   **c1**: performance instance
*   **fc.gpu.tesla. 1** :GPU-accelerated instances (Tesla T4)
*   **fc.gpu.ampere. 1** :GPU-accelerated instances (Ampere A10)
*   **g1**: same as **fc.gpu.tesla.1**

Default value: e1', example='e1'),
  layers?: [ string ](name='layers', description='A list of layers.

>  Multiple layers are merged based on the order of array subscripts. The content of a layer with a smaller subscript overwrites the file that has the same name of a layer with a larger subscript.'),
  memorySize?: int32(name='memorySize', description='The memory capacity for the function. Unit: MB. The memory capacity must be a multiple of 64 MB. The memory size varies based on the function instance type you use. For more information, see the "Instance types" section of the [Instance types and usage modes](~~179379~~) topic.', example='512'),
  runtime?: string(name='runtime', description='The runtime of the function. Valid values: **nodejs16**, **nodejs14**, **nodejs12**, **nodejs10**, **nodejs8**, **nodejs6**, **nodejs4.4**, **python3.10**, **python3.9**, **python3**, **python2.7**, **java11**, **java8**, **go1**, **php7.2**, **dotnetcore3.1**, **dotnetcore2.1**, **custom.debian10**, **custom**, and **custom-container**. For more information, see [Runtimes that are supported by Function Compute](~~73338~~).', example='python3.9'),
  timeout?: int32(name='timeout', description='The timeout period for function execution. Unit: seconds. Minimum value: 1. Default value: 3. When this period is elapsed, function execution is terminated.', example='60'),
}

model CreateFunctionResponseBody = {
  caPort?: int32(name='caPort', description='The port on which the HTTP server listens for the custom runtime or custom container runtime.', example='9000'),
  codeChecksum?: string(name='codeChecksum', description='The CRC-64 value of the function code package.', example='5434025278388143772'),
  codeSize?: long(name='codeSize', description='The size of the function code package that is returned by the system. Unit: bytes.', example='1024'),
  cpu?: float(name='cpu', description='The number of vCPUs of the function. The value is a multiple of 0.05.', example='1.5'),
  createdTime?: string(name='createdTime', description='The time when the function was created.', example='2016-08-15T15:00:00.000+0000'),
  customContainerConfig?: CustomContainerConfig(name='customContainerConfig', description='The configurations of the custom container runtime. After you configure the custom container runtime, Function Compute can execute the function in a container created from a custom image.'),
  customDNS?: CustomDNS(name='customDNS', description='The custom DNS configurations of the function.'),
  customHealthCheckConfig?: CustomHealthCheckConfig(name='customHealthCheckConfig', description='The custom health check configuration of the function. This parameter is applicable only to custom runtimes and custom containers.'),
  customRuntimeConfig?: CustomRuntimeConfig(name='customRuntimeConfig', description='The configurations of the custom runtime.'),
  description?: string(name='description', description='The description of the function.', example='This is a demo hello world function'),
  diskSize?: int32(name='diskSize', description='The disk size of the function. Unit: MB. Valid values: 512 and 10240.', example='512'),
  environmentVariables?: map[string]string(name='environmentVariables', description='The environment variables that are configured for the function. You can obtain the values of the environment variables from the function. For more information, see [Environment variables](~~69777~~).'),
  functionId?: string(name='functionId', description='The unique ID that is generated by the system for the function.', example='2d28e0e9-9ba5-4eed-8b1a-d3d9cd24
****'),
  functionName?: string(name='functionName', description='The name of the function.', example='demo-function'),
  gpuMemorySize?: int32(name='gpuMemorySize', description='The GPU memory capacity for the function. Unit: MB. The value is a multiple of 1,024.', example='2048'),
  handler?: string(name='handler', description='The handler of the function.', example='index.handler'),
  initializationTimeout?: int32(name='initializationTimeout', description='The timeout period for the execution of the Initializer hook. Unit: seconds. Default value: 3. Minimum value: 1. When the period ends, the execution of the Initializer hook is terminated.', example='60'),
  initializer?: string(name='initializer', description='The handler of the Initializer hook. The format is determined by the programming language.', example='index.handler'),
  instanceConcurrency?: int32(name='instanceConcurrency', description='The number of requests that can be concurrently processed by a single instance.', example='10'),
  instanceLifecycleConfig?: InstanceLifecycleConfig(name='instanceLifecycleConfig', description='The lifecycle configurations of the instance.'),
  instanceSoftConcurrency?: int32(name='instanceSoftConcurrency', description='The soft concurrency of the instance. You can use this parameter to implement graceful scale-up of instances. If the number of concurrent requests on an instance is greater than the value of soft concurrency, an instance scale-up is triggered. For example, if your instance requires a long time to start, you can specify a suitable soft concurrency to start the instance in advance.

The value must be less than or equal to that of the **instanceConcurrency** parameter.', example='5'),
  instanceType?: string(name='instanceType', description='The instance type of the function. Valid values:

*   **e1**: elastic instance
*   **c1**: performance instance
*   **fc.gpu.tesla.1**: GPU-accelerated instance (Tesla T4)
*   **fc.gpu.ampere.1**: GPU-accelerated instance (Ampere A10)
*   **g1**: same as **fc.gpu.tesla.1**', example='e1'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the function was last modified.', example='2016-08-15T17:00:00.000+0000'),
  layers?: [ string ](name='layers', description='An array that consists of the information of layers.

>  If multiple layers exist, the layers are merged based on the array subscripts in descending order. The content of a layer with a smaller subscript overwrites that of a larger subscript.'),
  layersArnV2?: [ string ](name='layersArnV2', description='ARN list of layers'),
  memorySize?: int32(name='memorySize', description='The memory size that is configured for the function. Unit: MB.', example='512'),
  runtime?: string(name='runtime', description='The runtime environment of the function. Valid values: **nodejs16**, **nodejs14**, **nodejs12**, **nodejs10**, **nodejs8**, **nodejs6**, **nodejs4.4**, **python3.10**, **python3.9**, **python3**, **python2.7**, **java11**, **java8**, **go1**, **php7.2**, **dotnetcore3.1**, **dotnetcore2.1**, **custom.debian10**, **custom**, and **custom-container**. For more information, see [Supported function runtime environments](~~73338~~).', example='python3.9'),
  timeout?: int32(name='timeout', description='The timeout period for the execution of the function. Unit: seconds. Default value: 60. Valid values: 1 to 600. When this period expires, the execution of the function is terminated.', example='10'),
}

model CreateFunctionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFunctionResponseBody(name='body'),
}

async function createFunctionWithOptions(serviceName: string, request: CreateFunctionRequest, headers: CreateFunctionHeaders, runtime: Util.RuntimeOptions): CreateFunctionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.caPort)) {
    body['caPort'] = request.caPort;
  }
  if (!Util.isUnset(request.code)) {
    body['code'] = request.code;
  }
  if (!Util.isUnset(request.cpu)) {
    body['cpu'] = request.cpu;
  }
  if (!Util.isUnset(request.customContainerConfig)) {
    body['customContainerConfig'] = request.customContainerConfig;
  }
  if (!Util.isUnset(request.customDNS)) {
    body['customDNS'] = request.customDNS;
  }
  if (!Util.isUnset(request.customHealthCheckConfig)) {
    body['customHealthCheckConfig'] = request.customHealthCheckConfig;
  }
  if (!Util.isUnset(request.customRuntimeConfig)) {
    body['customRuntimeConfig'] = request.customRuntimeConfig;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.diskSize)) {
    body['diskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.environmentVariables)) {
    body['environmentVariables'] = request.environmentVariables;
  }
  if (!Util.isUnset(request.functionName)) {
    body['functionName'] = request.functionName;
  }
  if (!Util.isUnset(request.gpuMemorySize)) {
    body['gpuMemorySize'] = request.gpuMemorySize;
  }
  if (!Util.isUnset(request.handler)) {
    body['handler'] = request.handler;
  }
  if (!Util.isUnset(request.initializationTimeout)) {
    body['initializationTimeout'] = request.initializationTimeout;
  }
  if (!Util.isUnset(request.initializer)) {
    body['initializer'] = request.initializer;
  }
  if (!Util.isUnset(request.instanceConcurrency)) {
    body['instanceConcurrency'] = request.instanceConcurrency;
  }
  if (!Util.isUnset(request.instanceLifecycleConfig)) {
    body['instanceLifecycleConfig'] = request.instanceLifecycleConfig;
  }
  if (!Util.isUnset(request.instanceSoftConcurrency)) {
    body['instanceSoftConcurrency'] = request.instanceSoftConcurrency;
  }
  if (!Util.isUnset(request.instanceType)) {
    body['instanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.layers)) {
    body['layers'] = request.layers;
  }
  if (!Util.isUnset(request.memorySize)) {
    body['memorySize'] = request.memorySize;
  }
  if (!Util.isUnset(request.runtime)) {
    body['runtime'] = request.runtime;
  }
  if (!Util.isUnset(request.timeout)) {
    body['timeout'] = request.timeout;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcCodeChecksum)) {
    realHeaders['X-Fc-Code-Checksum'] = Util.toJSONString(headers.xFcCodeChecksum);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateFunction',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createFunction(serviceName: string, request: CreateFunctionRequest): CreateFunctionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateFunctionHeaders{};
  return createFunctionWithOptions(serviceName, request, headers, runtime);
}

model CreateLayerVersionHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='r4isu4sls****'),
}

model CreateLayerVersionRequest {
  code?: Code(name='Code', description='The layer code.'),
  compatibleRuntime?: [ string ](name='compatibleRuntime', description='The runtimes that are supported by the layer.'),
  description?: string(name='description', description='The layer description. The description can be up to 256 characters in length.', example='test'),
}

model CreateLayerVersionResponseBody = {
  acl?: int32(name='acl', description='The access mode of the layer. Digit 0 specifies that the layer is private and digit 1 specifies that the layer is public. By default, public layers are public. Custom layers can be set to private or public.', example='0'),
  arn?: string(name='arn', description='The Alibaba Cloud Resource Name (ARN) of the layer.', example='xxxxxxxx#Layer-name#1'),
  code?: OutputCodeLocation(name='code', description='The information about the layer code package.'),
  codeChecksum?: string(name='codeChecksum', description='The CRC-64 value of the layer code package. The value is calculated based on the **ECMA-182 **standard.', example='2825179536350****'),
  codesize?: long(name='codesize', description='The size of the layer code package. Unit: bytes.', example='421'),
  compatibleRuntime?: [ string ](name='compatibleRuntime', description='The runtimes that are supported by the layer.'),
  createTime?: string(name='createTime', description='The time when the layer version was created. The time is in the yyyy-MM-ddTHH:mm:ssZ format.', example='2022-01-01T11:08:00Z'),
  description?: string(name='description', description='The description of the layer version.', example='the first layer'),
  layerName?: string(name='layerName', description='The layer name.', example='MyLayer'),
  version?: int32(name='version', description='The layer version.', example='1'),
}

model CreateLayerVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateLayerVersionResponseBody(name='body'),
}

async function createLayerVersionWithOptions(layerName: string, request: CreateLayerVersionRequest, headers: CreateLayerVersionHeaders, runtime: Util.RuntimeOptions): CreateLayerVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.code)) {
    body['Code'] = request.code;
  }
  if (!Util.isUnset(request.compatibleRuntime)) {
    body['compatibleRuntime'] = request.compatibleRuntime;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateLayerVersion',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/layers/${OpenApiUtil.getEncodeParam(layerName)}/versions`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createLayerVersion(layerName: string, request: CreateLayerVersionRequest): CreateLayerVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateLayerVersionHeaders{};
  return createLayerVersionWithOptions(layerName, request, headers, runtime);
}

model CreateServiceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='asdf****'),
}

model CreateServiceRequest {
  description?: string(name='description', description='The description of the service.', example='service_description'),
  internetAccess?: boolean(name='internetAccess', description='Specifies whether to allow functions to access the Internet. Valid values:

*   **true**: allows functions to access the Internet. This is the default value.
*   **false**: does not allow functions to access the Internet.', example='true'),
  logConfig?: LogConfig(name='logConfig', description='The log configuration. Function Compute writes function execution logs to the specified Logstore.'),
  nasConfig?: NASConfig(name='nasConfig', description='The configuration of the Apsara File Storage NAS (NAS) file system. The configurations allow functions in the specified service to access the NAS file system.'),
  ossMountConfig?: OSSMountConfig(name='ossMountConfig', description='The OSS mount configurations.'),
  role?: string(name='role', description='The RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:

*   Sends function execution logs to your Logstore.
*   Generates a token for a function to access other cloud resources during function execution.', example='acs:ram::188077086902****:role/fc-test'),
  serviceName?: string(name='serviceName', description='The name of the service. The name can contain only letters, digits, hyphens (-), and underscores (\\_). It cannot start with a digit or hyphen (-). It must be 1 to 128 characters in length.', example='service_Name'),
  tracingConfig?: TracingConfig(name='tracingConfig', description='The configuration of Tracing Analysis. After Function Compute is integrated with Tracing Analysis, you can record the duration of a request in Function Compute, view the cold start time of a function, and record the execution duration of a function. For more information, see [Tracing Analysis](~~189804~~).'),
  vpcConfig?: VPCConfig(name='vpcConfig', description='The VPC configurations. The configurations allow functions in the specified service to access the specified VPC.'),
}

model CreateServiceResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the service was created.', example='2016-08-15T16:06:05.000+0000'),
  description?: string(name='description', description='The description of the service.', example='service_description'),
  internetAccess?: boolean(name='internetAccess', description='Specifies whether to allow functions to access the Internet. Valid values:

*   **true**: allows functions in the specified service to access the Internet.
*   **false**: does not allow functions in the specified service to access the Internet.', example='true'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the service was last modified.', example='2016-08-15T16:06:05.000+0000'),
  logConfig?: LogConfig(name='logConfig', description='The log configuration. Function Compute writes function execution logs to the specified Logstore.'),
  nasConfig?: NASConfig(name='nasConfig', description='The configuration of the NAS file system. The configurations allow functions in the specified service to access the NAS file system.'),
  ossMountConfig?: OSSMountConfig(name='ossMountConfig', description='The OSS mount configurations.'),
  role?: string(name='role', description='The RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:

*   Sends function execution logs to your Logstore.
*   Generates a token for a function to access other cloud resources during function execution.', example='acs:ram::188077086902****:role/fc-test'),
  serviceId?: string(name='serviceId', description='The unique ID generated by the system for the service.', example='2d28e0e9-9ba5-4eed-8b1a-d3d9cd24e737'),
  serviceName?: string(name='serviceName', description='The name of the service.', example='service_Name'),
  tracingConfig?: TracingConfig(name='tracingConfig', description='The configuration of Tracing Analysis. After Function Compute is integrated with Tracing Analysis, you can record the duration of a request in Function Compute, view the cold start time of a function, and record the execution duration of a function. For more information, see [Tracing Analysis](~~189804~~).'),
  useSLRAuthentication?: boolean(name='useSLRAuthentication'),
  vpcConfig?: VPCConfig(name='vpcConfig', description='The VPC configurations. The configurations allow functions in the specified service to access the specified VPC.'),
}

model CreateServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateServiceResponseBody(name='body'),
}

async function createServiceWithOptions(request: CreateServiceRequest, headers: CreateServiceHeaders, runtime: Util.RuntimeOptions): CreateServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.internetAccess)) {
    body['internetAccess'] = request.internetAccess;
  }
  if (!Util.isUnset(request.logConfig)) {
    body['logConfig'] = request.logConfig;
  }
  if (!Util.isUnset(request.nasConfig)) {
    body['nasConfig'] = request.nasConfig;
  }
  if (!Util.isUnset(request.ossMountConfig)) {
    body['ossMountConfig'] = request.ossMountConfig;
  }
  if (!Util.isUnset(request.role)) {
    body['role'] = request.role;
  }
  if (!Util.isUnset(request.serviceName)) {
    body['serviceName'] = request.serviceName;
  }
  if (!Util.isUnset(request.tracingConfig)) {
    body['tracingConfig'] = request.tracingConfig;
  }
  if (!Util.isUnset(request.vpcConfig)) {
    body['vpcConfig'] = request.vpcConfig;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateService',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createService(request: CreateServiceRequest): CreateServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateServiceHeaders{};
  return createServiceWithOptions(request, headers, runtime);
}

model CreateTriggerHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the request is initiated on the client. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='my-test-trace-id'),
}

model CreateTriggerRequest {
  description?: string(name='description', description='The description of the trigger.', example='trigger for test'),
  invocationRole?: string(name='invocationRole', description='The role that is used by the event source such as Object Storage Service (OSS) to invoke the function. For more information, see [Overview](~~53102~~).', example='acs:ram::1234567890:role/fc-test'),
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
  sourceArn?: string(name='sourceArn', description='The Alibaba Cloud Resource Name (ARN) of the event source for the trigger.', example='acs:oss:cn-shanghai:12345:mybucket'),
  triggerConfig?: string(name='triggerConfig', description='The configurations of the trigger. The configurations vary based on the trigger type. For more information about the format, see the following topics:

*   Object Storage Service (OSS) trigger: [OSSTriggerConfig](~~415697~~).
*   Simple Log Service trigger: [LogTriggerConfig](~~415694~~).
*   Time trigger: [TimeTriggerConfig](~~415712~~).
*   HTTP trigger: [HTTPTriggerConfig](~~415685~~).
*   Tablestore trigger: Specify the **SourceArn** parameter and leave this parameter empty.
*   Alibaba Cloud CDN event trigger: [CDNEventsTriggerConfig](~~415674~~).
*   Message Service (MNS) topic trigger: [MnsTopicTriggerConfig](~~415695~~).
*   EventBridge triggers: [EventBridgeTriggerConfig](~~2508622~~).', example='{"events": ["oss:ObjectCreated:*"], "filter": {"key": {"prefix": "/prefix", "suffix": ".zip"}}}'),
  triggerName?: string(name='triggerName', description='The name of the trigger. The name contains only letters, digits, hyphens (-), and underscores (\\_). The name must be 1 to 128 characters in length and cannot start with a digit or hyphen (-).', example='oss_create_object_demo'),
  triggerType?: string(name='triggerType', description='The type of the trigger. Valid values:

*   **oss**: OSS event trigger. For more information, see [Overview](~~62922~~).
*   **log**: Simple Log Service trigger. For more information, see [Overview](~~84386~~).
*   **timer**: time trigger. For more information, see [Overview](~~68172~~).
*   **http**: HTTP trigger. For more information, see [Overview](~~71229~~).
*   **tablestore**: Tablestore trigger. For more information, see [Overview](~~100092~~).
*   **cdn_events**: CDN event trigger. For more information, see [Overview](~~73333~~).
*   **mns_topic**: MNS topic trigger. For more information, see [Overview](~~97032~~).
*   **eventbridge**: EventBridge triggers.', example='oss'),
}

model CreateTriggerResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the trigger was created.', example='2016-08-15T15:00:00.000+0000'),
  description?: string(name='description', description='The description of the trigger.', example='trigger for test'),
  domainName?: string(name='domainName', description='The domain name used to invoke the function by using HTTP. You can add this domain name as the prefix to the endpoint of Function Compute. This way, you can invoke the function that corresponds to the trigger by using HTTP. For example, `{domainName}.cn-shanghai.fc.aliyuncs.com`.', example='demo-service-demo-function-jkhksh'),
  invocationRole?: string(name='invocationRole', description='The ARN of the RAM role that is used by the event source to invoke the function.', example='acs:ram::1234567890:role/fc-test'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the trigger was last modified.', example='016-08-15T17:00:00.000+0000'),
  qualifier?: string(name='qualifier', description='The version of the service.', example='LATEST'),
  sourceArn?: string(name='sourceArn', description='The ARN of the event source.', example='acs:oss:cn-shanghai:12345:mybucket'),
  triggerConfig?: string(name='triggerConfig', description='The configurations of the trigger. The configurations vary based on the trigger type.', example='{"events": ["oss:ObjectCreated:*"], "filter": {"key": {"prefix": "/prefix", "suffix": ".zip"}}}'),
  triggerId?: string(name='triggerId', description='The unique ID of the trigger.', example='3e270f2f-cef2-421a-bc86-ff4e8088****'),
  triggerName?: string(name='triggerName', description='The name of the trigger. The name contains only letters, digits, hyphens (-), and underscores (\\_). The name must be 1 to 128 characters in length and cannot start with a digit or hyphen (-).', example='oss_create_object_trigger_demo'),
  triggerType?: string(name='triggerType', description='The trigger type. Valid values: **oss**, **log**, **tablestore**, **timer**, **http**, **cdn_events**, **mns_topic**, and **eventbridge**.', example='oss'),
  urlInternet?: string(name='urlInternet', description='The public domain address. You can access HTTP triggers over the Internet by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou.fcapp.run'),
  urlIntranet?: string(name='urlIntranet', description='The private endpoint. In a VPC, you can access HTTP triggers by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou-vpc.fcapp.run'),
}

model CreateTriggerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTriggerResponseBody(name='body'),
}

async function createTriggerWithOptions(serviceName: string, functionName: string, request: CreateTriggerRequest, headers: CreateTriggerHeaders, runtime: Util.RuntimeOptions): CreateTriggerResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.invocationRole)) {
    body['invocationRole'] = request.invocationRole;
  }
  if (!Util.isUnset(request.qualifier)) {
    body['qualifier'] = request.qualifier;
  }
  if (!Util.isUnset(request.sourceArn)) {
    body['sourceArn'] = request.sourceArn;
  }
  if (!Util.isUnset(request.triggerConfig)) {
    body['triggerConfig'] = request.triggerConfig;
  }
  if (!Util.isUnset(request.triggerName)) {
    body['triggerName'] = request.triggerName;
  }
  if (!Util.isUnset(request.triggerType)) {
    body['triggerType'] = request.triggerType;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTrigger',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/triggers`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTrigger(serviceName: string, functionName: string, request: CreateTriggerRequest): CreateTriggerResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateTriggerHeaders{};
  return createTriggerWithOptions(serviceName, functionName, request, headers, runtime);
}

model CreateVpcBindingHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The request ID.', example='asdf****'),
}

model CreateVpcBindingRequest {
  vpcId?: string(name='vpcId', description='The ID of the VPC to be bound.', example='v-xxxx'),
}

model CreateVpcBindingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function createVpcBindingWithOptions(serviceName: string, request: CreateVpcBindingRequest, headers: CreateVpcBindingHeaders, runtime: Util.RuntimeOptions): CreateVpcBindingResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.vpcId)) {
    body['vpcId'] = request.vpcId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateVpcBinding',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/bindings`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function createVpcBinding(serviceName: string, request: CreateVpcBindingRequest): CreateVpcBindingResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new CreateVpcBindingHeaders{};
  return createVpcBindingWithOptions(serviceName, request, headers, runtime);
}

model DeleteAliasHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='If the ETag specified in a request matches the ETag value of the object, OSS transmits the object and returns 200 OK. If the ETag specified in a request does not match the ETag value of the object, OSS returns 412 Precondition Failed.

The ETag value of a resource is used to check whether the resource has changed. You can check data integrity by using the ETag value. Default value: null.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='r9s89isisi****'),
}

model DeleteAliasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteAliasWithOptions(serviceName: string, aliasName: string, headers: DeleteAliasHeaders, runtime: Util.RuntimeOptions): DeleteAliasResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteAlias',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/aliases/${OpenApiUtil.getEncodeParam(aliasName)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteAlias(serviceName: string, aliasName: string): DeleteAliasResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteAliasHeaders{};
  return deleteAliasWithOptions(serviceName, aliasName, headers, runtime);
}

model DeleteCustomDomainHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the API was called. Format: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The request ID.', example='rid281s******'),
}

model DeleteCustomDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteCustomDomainWithOptions(domainName: string, headers: DeleteCustomDomainHeaders, runtime: Util.RuntimeOptions): DeleteCustomDomainResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteCustomDomain',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/custom-domains/${OpenApiUtil.getEncodeParam(domainName)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteCustomDomain(domainName: string): DeleteCustomDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteCustomDomainHeaders{};
  return deleteCustomDomainWithOptions(domainName, headers, runtime);
}

model DeleteFunctionHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='The ETag value of the resource. This value is used to ensure that the modified resource is consistent with the resource to be modified. The ETag value is returned in the responses of the CREATE, GET, and UPDATE operations.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when Function Compute API is called. Specify the time in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API. The value is the same as that of the requestId parameter in the response.', example='test-trace-id'),
}

model DeleteFunctionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteFunctionWithOptions(serviceName: string, functionName: string, headers: DeleteFunctionHeaders, runtime: Util.RuntimeOptions): DeleteFunctionResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteFunction',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteFunction(serviceName: string, functionName: string): DeleteFunctionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteFunctionHeaders{};
  return deleteFunctionWithOptions(serviceName, functionName, headers, runtime);
}

model DeleteFunctionAsyncInvokeConfigHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf*****'),
}

model DeleteFunctionAsyncInvokeConfigRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='test'),
}

model DeleteFunctionAsyncInvokeConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteFunctionAsyncInvokeConfigWithOptions(serviceName: string, functionName: string, request: DeleteFunctionAsyncInvokeConfigRequest, headers: DeleteFunctionAsyncInvokeConfigHeaders, runtime: Util.RuntimeOptions): DeleteFunctionAsyncInvokeConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFunctionAsyncInvokeConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/async-invoke-config`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteFunctionAsyncInvokeConfig(serviceName: string, functionName: string, request: DeleteFunctionAsyncInvokeConfigRequest): DeleteFunctionAsyncInvokeConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteFunctionAsyncInvokeConfigHeaders{};
  return deleteFunctionAsyncInvokeConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model DeleteFunctionOnDemandConfigHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='If the ETag specified in a request matches the ETag value of the object, OSS transmits the object and returns 200 OK. If the ETag specified in a request does not match the ETag value of the object, OSS returns 412 Precondition Failed.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID, which is the unique identifier of a trace.', example='r9s89isisi****'),
}

model DeleteFunctionOnDemandConfigRequest {
  qualifier?: string(name='qualifier', description='The service alias or LATEST. Versions are not supported.', example='prod'),
}

model DeleteFunctionOnDemandConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteFunctionOnDemandConfigWithOptions(serviceName: string, functionName: string, request: DeleteFunctionOnDemandConfigRequest, headers: DeleteFunctionOnDemandConfigHeaders, runtime: Util.RuntimeOptions): DeleteFunctionOnDemandConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFunctionOnDemandConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/on-demand-config`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteFunctionOnDemandConfig(serviceName: string, functionName: string, request: DeleteFunctionOnDemandConfigRequest): DeleteFunctionOnDemandConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteFunctionOnDemandConfigHeaders{};
  return deleteFunctionOnDemandConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model DeleteLayerVersionHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model DeleteLayerVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteLayerVersionWithOptions(layerName: string, version: string, headers: DeleteLayerVersionHeaders, runtime: Util.RuntimeOptions): DeleteLayerVersionResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteLayerVersion',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/layers/${OpenApiUtil.getEncodeParam(layerName)}/versions/${OpenApiUtil.getEncodeParam(version)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteLayerVersion(layerName: string, version: string): DeleteLayerVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteLayerVersionHeaders{};
  return deleteLayerVersionWithOptions(layerName, version, headers, runtime);
}

model DeleteServiceHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='The value that is used to ensure that the modified service is consistent with the service to be modified. The value of this parameter comes from responses of the [CreateService](~~175256~~), [UpdateService](~~188167~~), and [GetService](~~189225~~) operation.', example='service_name'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the Function Compute API was called. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The request ID.', example='r9s89isisi****'),
}

model DeleteServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteServiceWithOptions(serviceName: string, headers: DeleteServiceHeaders, runtime: Util.RuntimeOptions): DeleteServiceResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteService',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteService(serviceName: string): DeleteServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteServiceHeaders{};
  return deleteServiceWithOptions(serviceName, headers, runtime);
}

model DeleteServiceVersionHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='rid281s******'),
}

model DeleteServiceVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteServiceVersionWithOptions(serviceName: string, versionId: string, headers: DeleteServiceVersionHeaders, runtime: Util.RuntimeOptions): DeleteServiceVersionResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteServiceVersion',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/versions/${OpenApiUtil.getEncodeParam(versionId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteServiceVersion(serviceName: string, versionId: string): DeleteServiceVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteServiceVersionHeaders{};
  return deleteServiceVersionWithOptions(serviceName, versionId, headers, runtime);
}

model DeleteTriggerHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='This parameter is used to ensure that the modified resource is consistent with the resource to be modified. You can obtain the parameter value from the responses of [CreateTrigger](~~415729~~), [GetTrigger](~~415732~~), and [UpdateTrigger](~~415731~~) operations.', example='e19d5cd5af0378da05f63f891c74****'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the request is initiated on the client. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='my-test-trace-id'),
}

model DeleteTriggerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteTriggerWithOptions(serviceName: string, functionName: string, triggerName: string, headers: DeleteTriggerHeaders, runtime: Util.RuntimeOptions): DeleteTriggerResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTrigger',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/triggers/${OpenApiUtil.getEncodeParam(triggerName)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteTrigger(serviceName: string, functionName: string, triggerName: string): DeleteTriggerResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteTriggerHeaders{};
  return deleteTriggerWithOptions(serviceName, functionName, triggerName, headers, runtime);
}

model DeleteVpcBindingHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of the Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The request ID.', example='asdf****'),
}

model DeleteVpcBindingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deleteVpcBindingWithOptions(serviceName: string, vpcId: string, headers: DeleteVpcBindingHeaders, runtime: Util.RuntimeOptions): DeleteVpcBindingResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'DeleteVpcBinding',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/bindings/${OpenApiUtil.getEncodeParam(vpcId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteVpcBinding(serviceName: string, vpcId: string): DeleteVpcBindingResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeleteVpcBindingHeaders{};
  return deleteVpcBindingWithOptions(serviceName, vpcId, headers, runtime);
}

model DeregisterEventSourceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model DeregisterEventSourceRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
}

model DeregisterEventSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function deregisterEventSourceWithOptions(serviceName: string, functionName: string, sourceArn: string, request: DeregisterEventSourceRequest, headers: DeregisterEventSourceHeaders, runtime: Util.RuntimeOptions): DeregisterEventSourceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeregisterEventSource',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/event-sources/${OpenApiUtil.getEncodeParam(sourceArn)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deregisterEventSource(serviceName: string, functionName: string, sourceArn: string, request: DeregisterEventSourceRequest): DeregisterEventSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new DeregisterEventSourceHeaders{};
  return deregisterEventSourceWithOptions(serviceName, functionName, sourceArn, request, headers, runtime);
}

model GetAccountSettingsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the Function Compute API was called. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The request ID.', example='rid281s******'),
}

model GetAccountSettingsResponseBody = {
  availableAZs?: [ string ](name='availableAZs', description='The zone IDs.'),
  defaultRole?: string(name='defaultRole', description='The default service role.', example='acs:ram::1234:role/aliyunfcdefaultrole'),
}

model GetAccountSettingsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAccountSettingsResponseBody(name='body'),
}

async function getAccountSettingsWithOptions(headers: GetAccountSettingsHeaders, runtime: Util.RuntimeOptions): GetAccountSettingsResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'GetAccountSettings',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/account-settings`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAccountSettings(): GetAccountSettingsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetAccountSettingsHeaders{};
  return getAccountSettingsWithOptions(headers, runtime);
}

model GetAliasHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='r4isu4sls****'),
}

model GetAliasResponseBody = {
  additionalVersionWeight?: map[string]float(name='additionalVersionWeight', description='The additional version to which the alias points and the weight of the additional version.

*   The additional version takes effect only when the function is invoked.
*   The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.'),
  aliasName?: string(name='aliasName', description='The name of the alias.', example='alias_test'),
  createdTime?: string(name='createdTime', description='The time when the alias was created.', example='2020-07-27T06:37:29Z'),
  description?: string(name='description', description='The description of the alias.', example='test_description'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the alias was last modified.', example='2020-07-27T06:37:29Z'),
  resolvePolicy?: string(name='resolvePolicy', description='The canary release mode. Valid values:

*   **Random**: random canary release. This is the default value.
*   **Content**: rule-based canary release.', example='Random'),
  routePolicy?: RoutePolicy(name='routePolicy', description='The canary release rule. Traffic that meets the canary release rule is routed to the canary release instance.'),
  versionId?: string(name='versionId', description='The version to which the alias points.', example='2'),
}

model GetAliasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAliasResponseBody(name='body'),
}

async function getAliasWithOptions(serviceName: string, aliasName: string, headers: GetAliasHeaders, runtime: Util.RuntimeOptions): GetAliasResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'GetAlias',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/aliases/${OpenApiUtil.getEncodeParam(aliasName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAlias(serviceName: string, aliasName: string): GetAliasResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetAliasHeaders{};
  return getAliasWithOptions(serviceName, aliasName, headers, runtime);
}

model GetCustomDomainHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the operation is called. The format is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='r4isu4sls****'),
}

model GetCustomDomainResponseBody = {
  accountId?: string(name='accountId', description='The ID of your Alibaba Cloud account.', example='2016-08-15'),
  apiVersion?: string(name='apiVersion', description='The version of the API.', example='2016-08-15'),
  certConfig?: CertConfig(name='certConfig', description='The configuration of the HTTPS certificate.'),
  createdTime?: string(name='createdTime', description='The time when the custom domain name was created.', example='2020-07-27T08:02:19Z'),
  domainName?: string(name='domainName', description='The domain name.', example='example.com'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the domain name was last modified.', example='2020-07-27T08:02:19Z'),
  protocol?: string(name='protocol', description='The protocol types supported by the domain name. Valid values:

*   **HTTP**: Only HTTP is supported.
*   **HTTPS**: Only HTTPS is supported.
*   **HTTP,HTTPS**: HTTP and HTTPS are supported.', example='HTTP'),
  routeConfig?: RouteConfig(name='routeConfig', description='The configuration of the route table. The route table maps paths to functions when the functions are invoked by using custom domain names.'),
  tlsConfig?: TLSConfig(name='tlsConfig', description='The TLS configurations.'),
  wafConfig?: WAFConfig(name='wafConfig', description='Web Application Firewall (WAF) configurations.'),
}

model GetCustomDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCustomDomainResponseBody(name='body'),
}

async function getCustomDomainWithOptions(domainName: string, headers: GetCustomDomainHeaders, runtime: Util.RuntimeOptions): GetCustomDomainResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'GetCustomDomain',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/custom-domains/${OpenApiUtil.getEncodeParam(domainName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCustomDomain(domainName: string): GetCustomDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetCustomDomainHeaders{};
  return getCustomDomainWithOptions(domainName, headers, runtime);
}

model GetFunctionHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='asdf****'),
}

model GetFunctionRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='demoQualifier'),
}

model GetFunctionResponseBody = {
  caPort?: int32(name='caPort', description='The port on which the HTTP server listens for the custom runtime or custom container runtime.', example='9000'),
  codeChecksum?: string(name='codeChecksum', description='The CRC-64 value of the function code package.', example='2825179536350****'),
  codeSize?: long(name='codeSize', description='The size of the function code package. Unit: byte.', example='421'),
  cpu?: float(name='cpu', description='The number of vCPUs of the function. The value must be a multiple of 0.05.', example='1.5'),
  createdTime?: string(name='createdTime', description='The time when the function was created.', example='2020-04-01T08:15:27Z'),
  customContainerConfig?: CustomContainerConfigInfo(name='customContainerConfig', description='The configurations of the custom container runtime. After you configure the custom container runtime, Function Compute can execute the function in a container created from a custom image.'),
  customDNS?: CustomDNS(name='customDNS', description='The custom DNS configurations of the function.'),
  customHealthCheckConfig?: CustomHealthCheckConfig(name='customHealthCheckConfig', description='The custom health check configuration of the function. This parameter is applicable only to custom runtimes and custom containers.'),
  customRuntimeConfig?: CustomRuntimeConfig(name='customRuntimeConfig', description='The configurations of the custom runtime.'),
  description?: string(name='description', description='The description of the function.', example='test_description'),
  diskSize?: int32(name='diskSize', description='The disk size of the function. Unit: MB. Valid values: 512 and 10240.', example='512'),
  environmentVariables?: map[string]string(name='environmentVariables', description='The environment variables that are configured for the function. You can obtain the values of the environment variables from the function. For more information, see [Environment variables](~~69777~~).'),
  functionId?: string(name='functionId', description='The ID that is generated by the system for the function. Each function ID is unique in Function Compute.', example='aa715851-1c20-4b89-a8fb-***'),
  functionName?: string(name='functionName', description='The name of the function.', example='function_name'),
  gpuMemorySize?: int32(name='gpuMemorySize', description='The GPU memory capacity for the function. Unit: MB. The value is a multiple of 1,024.', example='2048'),
  handler?: string(name='handler', description='The handler of the function. For more information, see [Function handler](~~157704~~).', example='index.handler'),
  initializationTimeout?: int32(name='initializationTimeout', description='The timeout period for the execution of the Initializer hook. Unit: seconds. Default value: 3. Valid values: 1 to 300. When this period ends, the execution of the Initializer hook is terminated.', example='60'),
  initializer?: string(name='initializer', description='The handler of the Initializer hook. The format of the value is determined by the programming language that you use. For more information, see [Initializer hook](~~157704~~).', example='index.handler'),
  instanceConcurrency?: int32(name='instanceConcurrency', description='The number of requests that can be concurrently processed by a single instance.', example='10'),
  instanceLifecycleConfig?: InstanceLifecycleConfig(name='instanceLifecycleConfig', description='The lifecycle configurations of the instance.'),
  instanceSoftConcurrency?: int32(name='instanceSoftConcurrency', description='The soft concurrency of the instance. You can use this parameter to implement graceful scale-up of instances. If the number of concurrent requests on an instance is greater than the value of soft concurrency, an instance scale-up is triggered. For example, if your instance requires a long time to start, you can specify a suitable soft concurrency to start the instance in advance.

The value must be less than or equal to that of the **instanceConcurrency** parameter.', example='5'),
  instanceType?: string(name='instanceType', description='The instance type of the function. Valid values:

*   **e1**: elastic instance
*   **c1**: performance instance
*   **fc.gpu.tesla.1**: GPU-accelerated instance (Tesla T4)
*   **fc.gpu.ampere.1**: GPU-accelerated instance (Ampere A10)
*   **g1**: same as fc.gpu.tesla.1', example='e1'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the function was last modified.', example='2020-04-01T08:15:27Z'),
  layers?: [ string ](name='layers', description='The list of layers (ARN V1).

>  If multiple layers exist, the layers are merged based on the array subscripts in descending order. The content of a layer with a smaller subscript overwrites that of a larger subscript.

>  This parameter is to be deprecated. Use layersArnV2.'),
  layersArnV2?: [ string ](name='layersArnV2', description='The list of layers (ARN V2).

>  If multiple layers exist, the layers are merged based on the array subscripts in descending order. The content of a layer with a smaller subscript overwrites that of a larger subscript.'),
  memorySize?: int32(name='memorySize', description='The memory size for the function. Unit: MB. The value must be a multiple of 64. The memory size varies based on the function instance type. For more information, see [Instance types](~~179379~~).', example='256'),
  runtime?: string(name='runtime', description='The runtime environment of the function. Valid values: **nodejs16**, **nodejs14**, **nodejs12**, **nodejs10**, **nodejs8**, **nodejs6**, **nodejs4.4**, **python3.9**, **python3**, **python2.7**, **java11**, **java8**, **go1**, **php7.2**, **dotnetcore2.1**, **custom**, and **custom-container**.', example='python3'),
  timeout?: int32(name='timeout', description='The timeout period for the execution of the function. Unit: seconds. Default value: 60. Valid values: 1 to 600. When this period expires, the execution of the function is terminated.', example='60'),
}

model GetFunctionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFunctionResponseBody(name='body'),
}

async function getFunctionWithOptions(serviceName: string, functionName: string, request: GetFunctionRequest, headers: GetFunctionHeaders, runtime: Util.RuntimeOptions): GetFunctionResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetFunction',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getFunction(serviceName: string, functionName: string, request: GetFunctionRequest): GetFunctionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetFunctionHeaders{};
  return getFunctionWithOptions(serviceName, functionName, request, headers, runtime);
}

model GetFunctionAsyncInvokeConfigHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the Function Compute is called. The format is **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='asdf****'),
}

model GetFunctionAsyncInvokeConfigRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the function.', example='test'),
}

model GetFunctionAsyncInvokeConfigResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the desktop group was created.', example='2020-09-10T02:45:02Z'),
  destinationConfig?: DestinationConfig(name='destinationConfig', description='The configuration struct of the destination for asynchronous invocations.', example='{"onSuccess": null,"onFailure": {"destination": "acs:mns:cn-shanghai:123:/queues/xxx/messages"}}'),
  function?: string(name='function', description='The name of the function.', example='helloworld'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the configuration was last modified.', example='2020-09-10T02:45:02Z'),
  maxAsyncEventAgeInSeconds?: long(name='maxAsyncEventAgeInSeconds', description='The maximum validity period of a message.', example='300'),
  maxAsyncRetryAttempts?: long(name='maxAsyncRetryAttempts', description='The maximum number of retries allowed after an asynchronous invocation fails.', example='3'),
  qualifier?: string(name='qualifier', description='The version or alias of the service to which the function belongs.', example='test'),
  service?: string(name='service', description='The name of the service.', example='demo-service'),
  statefulInvocation?: boolean(name='statefulInvocation', description='Indicates whether the asynchronous task feature is enabled.

*   **true**: The asynchronous task feature is enabled.
*   **false**: The asynchronous task feature is disabled.', example='true'),
}

model GetFunctionAsyncInvokeConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFunctionAsyncInvokeConfigResponseBody(name='body'),
}

/**
  * StatefulAsyncInvocation indicates whether the asynchronous task feature is enabled. If the value of StatefulAsyncInvocation is true, the asynchronous task feature is enabled. All asynchronous invocations change to asynchronous task mode.
  *
  * @param request GetFunctionAsyncInvokeConfigRequest
  * @param headers GetFunctionAsyncInvokeConfigHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetFunctionAsyncInvokeConfigResponse
 */
async function getFunctionAsyncInvokeConfigWithOptions(serviceName: string, functionName: string, request: GetFunctionAsyncInvokeConfigRequest, headers: GetFunctionAsyncInvokeConfigHeaders, runtime: Util.RuntimeOptions): GetFunctionAsyncInvokeConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetFunctionAsyncInvokeConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/async-invoke-config`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * StatefulAsyncInvocation indicates whether the asynchronous task feature is enabled. If the value of StatefulAsyncInvocation is true, the asynchronous task feature is enabled. All asynchronous invocations change to asynchronous task mode.
  *
  * @param request GetFunctionAsyncInvokeConfigRequest
  * @return GetFunctionAsyncInvokeConfigResponse
 */
async function getFunctionAsyncInvokeConfig(serviceName: string, functionName: string, request: GetFunctionAsyncInvokeConfigRequest): GetFunctionAsyncInvokeConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetFunctionAsyncInvokeConfigHeaders{};
  return getFunctionAsyncInvokeConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model GetFunctionCodeHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='rid281s******'),
}

model GetFunctionCodeRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='demoQualifier'),
}

model GetFunctionCodeResponseBody = {
  checksum?: string(name='checksum', description='The CRC-64 value of the function code package.', example='1234567890'),
  url?: string(name='url', description='The URL of the function code package.', example='http://func-code.oss-cn-shanghai.aliyuncs.com/1a2b3c4d5e6f'),
}

model GetFunctionCodeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFunctionCodeResponseBody(name='body'),
}

async function getFunctionCodeWithOptions(serviceName: string, functionName: string, request: GetFunctionCodeRequest, headers: GetFunctionCodeHeaders, runtime: Util.RuntimeOptions): GetFunctionCodeResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetFunctionCode',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/code`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getFunctionCode(serviceName: string, functionName: string, request: GetFunctionCodeRequest): GetFunctionCodeResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetFunctionCodeHeaders{};
  return getFunctionCodeWithOptions(serviceName, functionName, request, headers, runtime);
}

model GetFunctionOnDemandConfigHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The unique ID of the trace.', example='asdf****'),
}

model GetFunctionOnDemandConfigRequest {
  qualifier?: string(name='qualifier', description='Service alias or LATEST. Other versions are not supported.', example='prod'),
}

model GetFunctionOnDemandConfigResponseBody = {
  maximumInstanceCount?: long(name='maximumInstanceCount', description='The maximum number of instances.', example='10'),
  resource?: string(name='resource', description='The description of the resource.', example='12345#servierName#qualifier#functionName'),
}

model GetFunctionOnDemandConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFunctionOnDemandConfigResponseBody(name='body'),
}

async function getFunctionOnDemandConfigWithOptions(serviceName: string, functionName: string, request: GetFunctionOnDemandConfigRequest, headers: GetFunctionOnDemandConfigHeaders, runtime: Util.RuntimeOptions): GetFunctionOnDemandConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetFunctionOnDemandConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/on-demand-config`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getFunctionOnDemandConfig(serviceName: string, functionName: string, request: GetFunctionOnDemandConfigRequest): GetFunctionOnDemandConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetFunctionOnDemandConfigHeaders{};
  return getFunctionOnDemandConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model GetLayerVersionHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model GetLayerVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: Layer  
}

async function getLayerVersionWithOptions(layerName: string, version: string, headers: GetLayerVersionHeaders, runtime: Util.RuntimeOptions): GetLayerVersionResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'GetLayerVersion',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/layers/${OpenApiUtil.getEncodeParam(layerName)}/versions/${OpenApiUtil.getEncodeParam(version)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getLayerVersion(layerName: string, version: string): GetLayerVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetLayerVersionHeaders{};
  return getLayerVersionWithOptions(layerName, version, headers, runtime);
}

model GetProvisionConfigHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='rid281s******'),
}

model GetProvisionConfigRequest {
  qualifier?: string(name='qualifier', description='The name of the alias.', example='prod'),
}

model GetProvisionConfigResponseBody = {
  alwaysAllocateCPU?: boolean(name='alwaysAllocateCPU', description='Specifies whether to always allocate CPU resources to function instances.', example='true'),
  current?: long(name='current', description='The number of current resources.', example='1'),
  currentError?: string(name='currentError', description='The error message returned if a provisioned instance fails to be created.', example='image not found'),
  resource?: string(name='resource', description='The resource description.', example='12345#servierName#qualifier#functionName'),
  scheduledActions?: [
    ScheduledActions
  ](name='scheduledActions', description='The configurations of scheduled auto scaling.'),
  target?: long(name='target', description='The expected number of resources.', example='5'),
  targetTrackingPolicies?: [
    TargetTrackingPolicies
  ](name='targetTrackingPolicies', description='The configurations of metric-based auto scaling.'),
}

model GetProvisionConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetProvisionConfigResponseBody(name='body'),
}

async function getProvisionConfigWithOptions(serviceName: string, functionName: string, request: GetProvisionConfigRequest, headers: GetProvisionConfigHeaders, runtime: Util.RuntimeOptions): GetProvisionConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetProvisionConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/provision-config`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getProvisionConfig(serviceName: string, functionName: string, request: GetProvisionConfigRequest): GetProvisionConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetProvisionConfigHeaders{};
  return getProvisionConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model GetResourceTagsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The request ID.', example='my-test-trace-id'),
}

model GetResourceTagsRequest {
  resourceArn?: string(name='resourceArn', description='The Alibaba Cloud Resource Name (ARN) of the resource.

>  You can use the value of this parameter to query information about the resource, such as the account, service, and region of the resource. You can manage tags only for services for top level resources.', example='acs:fc:cn-shanghai:188077086902****:services/demo'),
}

model GetResourceTagsResponseBody = {
  resourceArn?: string(name='resourceArn', description='The Alibaba Cloud Resource Name (ARN) of the resource.

>  You can use the value of this parameter to query information about the resource, such as the account, service, and region of the resource.', example='acs:fc:cn-shanghai:188077086902****:services/demo'),
  tags?: map[string]string(name='tags', description='The tag dictionary.', example='{"k1":"v1"}'),
}

model GetResourceTagsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceTagsResponseBody(name='body'),
}

async function getResourceTagsWithOptions(request: GetResourceTagsRequest, headers: GetResourceTagsHeaders, runtime: Util.RuntimeOptions): GetResourceTagsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.resourceArn)) {
    query['resourceArn'] = request.resourceArn;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceTags',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/tag`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getResourceTags(request: GetResourceTagsRequest): GetResourceTagsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetResourceTagsHeaders{};
  return getResourceTagsWithOptions(request, headers, runtime);
}

model GetServiceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='rid281s******'),
}

model GetServiceRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='test'),
}

model GetServiceResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the service was created.', example='2020-04-03T05:57:28Z'),
  description?: string(name='description', description='The description of the service.', example='demo-service-test'),
  internetAccess?: boolean(name='internetAccess', description='Specifies whether to allow functions to access the Internet. Valid values:

*   **true**: allows functions in the specified service to access the Internet.
*   **false**: does not allow functions to access the Internet.', example='true'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the service was last modified.', example='2020-04-03T05:57:28Z'),
  logConfig?: LogConfig(name='logConfig', description='The log configuration, which specifies a Logstore to store function execution logs.'),
  nasConfig?: NASConfig(name='nasConfig', description='The configurations of the NAS file system. The configuration allows functions in the specified service in Function Compute to access the NAS file system.'),
  ossMountConfig?: OSSMountConfig(name='ossMountConfig', description='The OSS mount configurations.'),
  role?: string(name='role', description='The RAM role that is used to grant required permissions to Function Compute. Scenarios:

*   Sends function execution logs to your Logstore.
*   Generates a token for a function to access other cloud resources during function execution.', example='acs:ram::1234567890:role/fc-test'),
  serviceId?: string(name='serviceId', description='The unique ID generated by the system for the service.', example='2d28e0e9-9ba5-4eed-8b1a-d3d9cd24e737'),
  serviceName?: string(name='serviceName', description='The name of the service.', example='demo-service'),
  tracingConfig?: TracingConfig(name='tracingConfig', description='The configuration of Tracing Analysis. After you configure Tracing Analysis for a service in Function Compute, you can record the execution duration of a request, view the amount of cold start time for a function, and record the execution duration of a function. For more information, see [Overview](~~189804~~).'),
  useSLRAuthentication?: boolean(name='useSLRAuthentication'),
  vpcConfig?: VPCConfig(name='vpcConfig', description='The VPC configuration. The configuration allows a function to access the specified VPC.'),
}

model GetServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetServiceResponseBody(name='body'),
}

async function getServiceWithOptions(serviceName: string, request: GetServiceRequest, headers: GetServiceHeaders, runtime: Util.RuntimeOptions): GetServiceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetService',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getService(serviceName: string, request: GetServiceRequest): GetServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetServiceHeaders{};
  return getServiceWithOptions(serviceName, request, headers, runtime);
}

model GetStatefulAsyncInvocationHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcCodeChecksum?: string(name='X-Fc-Code-Checksum', description='The CRC-64 value of the function code package. This value is used to check data integrity. The value is automatically calculated by a tool.', example='1506052139770049xxxx'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcInvocationType?: string(name='X-Fc-Invocation-Type', description='The method used to invoke the function. Valid values:

*   **Sync**: synchronous invocation mode
*   **Async**: asynchronous invocation mode', example='Async'),
  xFcLogType?: string(name='X-Fc-Log-Type', description='The method used to return logs. Default value: None. Valid values:

*   **Tail**: returns the last 4 KB of logs that are generated for the current request.
*   **None**: does not return logs for the request.', example='Tail'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model GetStatefulAsyncInvocationRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service to which the asynchronous task belongs.', example='LATEST'),
}

model GetStatefulAsyncInvocationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StatefulAsyncInvocation  
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request GetStatefulAsyncInvocationRequest
  * @param headers GetStatefulAsyncInvocationHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return GetStatefulAsyncInvocationResponse
 */
async function getStatefulAsyncInvocationWithOptions(serviceName: string, functionName: string, invocationId: string, request: GetStatefulAsyncInvocationRequest, headers: GetStatefulAsyncInvocationHeaders, runtime: Util.RuntimeOptions): GetStatefulAsyncInvocationResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcCodeChecksum)) {
    realHeaders['X-Fc-Code-Checksum'] = Util.toJSONString(headers.xFcCodeChecksum);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcInvocationType)) {
    realHeaders['X-Fc-Invocation-Type'] = Util.toJSONString(headers.xFcInvocationType);
  }
  if (!Util.isUnset(headers.xFcLogType)) {
    realHeaders['X-Fc-Log-Type'] = Util.toJSONString(headers.xFcLogType);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetStatefulAsyncInvocation',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/stateful-async-invocations/${OpenApiUtil.getEncodeParam(invocationId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request GetStatefulAsyncInvocationRequest
  * @return GetStatefulAsyncInvocationResponse
 */
async function getStatefulAsyncInvocation(serviceName: string, functionName: string, invocationId: string, request: GetStatefulAsyncInvocationRequest): GetStatefulAsyncInvocationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetStatefulAsyncInvocationHeaders{};
  return getStatefulAsyncInvocationWithOptions(serviceName, functionName, invocationId, request, headers, runtime);
}

model GetTriggerHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the request is initiated on the client. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='my-test-trace-id'),
}

model GetTriggerResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the trigger was created.', example='2016-08-15T15:00:00.000+0000'),
  description?: string(name='description', description='The description of the trigger.', example='trigger for test'),
  domainName?: string(name='domainName', description='The domain name used to invoke the function by using HTTP. You can add this domain name as the prefix to the endpoint of Function Compute. This way, you can invoke the function that corresponds to the trigger by using HTTP. For example, `{domainName}.cn-shanghai.fc.aliyuncs.com`.', example='demo-service-demo-function-jkhksh'),
  invocationRole?: string(name='invocationRole', description='The ARN of the RAM role that is used by the event source to invoke the function.', example='acs:ram::123456xxxx:role/fc-test'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the trigger was last modified.', example='016-08-15T17:00:00.000+0000'),
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
  sourceArn?: string(name='sourceArn', description='The ARN of the event source.', example='acs:oss:cn-shanghai:123456xxxx:mybucket'),
  triggerConfig?: string(name='triggerConfig', description='The configurations of the trigger. The configurations vary based on the trigger type. For more information about the format, see the following topics:

*   Object Storage Service (OSS) trigger: [OSSTriggerConfig](~~415697~~).
*   Simple Log Service trigger: [LogTriggerConfig](~~415694~~).
*   Time trigger: [TimeTriggerConfig](~~415712~~).
*   HTTP trigger: [HTTPTriggerConfig](~~415685~~).
*   Tablestore trigger: Specify the **SourceArn** parameter and leave this parameter empty.
*   Alibaba Cloud CDN event trigger: [CDNEventsTriggerConfig](~~415674~~).
*   Message Service (MNS) topic trigger: [MnsTopicTriggerConfig](~~415695~~).
*   EventBridge triggers: [EventBridgeTriggerConfig](~~2508622~~).', example='{"events": ["oss:ObjectCreated:*"], "filter": {"key": {"prefix": "/prefix", "suffix": ".zip"}}}'),
  triggerId?: string(name='triggerId', description='The unique ID of the trigger.', example='3e270f2f-cef2-421a-bc86-ff4e8088476a'),
  triggerName?: string(name='triggerName', description='The name of the trigger.', example='demoTrigger'),
  triggerType?: string(name='triggerType', description='The trigger type. Example values: **oss**, **log**, **tablestore**, **timer**, **http**, **cdn_events**, **mns_topic**, and **eventbridge**.', example='oss'),
  urlInternet?: string(name='urlInternet', description='The public domain address. You can access HTTP triggers over the Internet by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou.fcapp.run'),
  urlIntranet?: string(name='urlIntranet', description='The private endpoint. In a VPC, you can access HTTP triggers by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou-vpc.fcapp.run'),
}

model GetTriggerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTriggerResponseBody(name='body'),
}

async function getTriggerWithOptions(serviceName: string, functionName: string, triggerName: string, headers: GetTriggerHeaders, runtime: Util.RuntimeOptions): GetTriggerResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'GetTrigger',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/triggers/${OpenApiUtil.getEncodeParam(triggerName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTrigger(serviceName: string, functionName: string, triggerName: string): GetTriggerResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new GetTriggerHeaders{};
  return getTriggerWithOptions(serviceName, functionName, triggerName, headers, runtime);
}

model InvokeFunctionHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The format is **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcInvocationType?: string(name='X-Fc-Invocation-Type', description='The invocation method. Valid values:

*   **Sync**: synchronous invocations
*   **Async**: asynchronous invocations

Default value: Sync', example='Sync'),
  xFcLogType?: string(name='X-Fc-Log-Type', description='The method used to return logs. Valid values:

*   **Tail**: returns the last 4 KB of logs that are generated for the current request.
*   **None**: No logs are returned for the current request. Default value: None.', example='None'),
  xFcStatefulAsyncInvocationEnable?: string(name='X-Fc-Stateful-Async-Invocation-Enable', description='Specifies whether to enable the asynchronous task mode for requests. Default value: false. Valid values:

*   **true**
*   **false**

> This parameter takes effect only for asynchronous invocations. It does not take effect for synchronous invocations.', example='true'),
  xFcStatefulAsyncInvocationId?: string(name='X-Fc-Stateful-Async-Invocation-Id', description='The ID of the asynchronous task. You must enable the asynchronous task feature in advance.

> When you use an SDK to invoke a function, we recommend that you specify a business-related ID to facilitate subsequent operations. For example, you can use the video name as the invocation ID for a video-processing function. This way, you can use the ID to check whether the video is processed or terminate the processing of the video. The ID must start with a letter or an underscore (\\_) and can contain letters, digits, underscores (\\_), and hyphens (-). The ID can be up to 128 characters in length. If you do not specify the ID of the asynchronous invocation, Function Compute automatically generates an ID.', example='test-invoke-id'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API. The value is the same as that of the **requestId** parameter in the response.', example='test-trace-id'),
}

model InvokeFunctionRequest {
  body?: bytes(name='body', description='The event to be processed by the function. Set this parameter to a binary string. Function Compute passes the event to the function for processing.', example='{"key":"value"}'),
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='demoQualifier'),
}

model InvokeFunctionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: bytes(name='body'),
}

async function invokeFunctionWithOptions(serviceName: string, functionName: string, request: InvokeFunctionRequest, headers: InvokeFunctionHeaders, runtime: Util.RuntimeOptions): InvokeFunctionResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var body : bytes = null;
  if (!Util.isUnset(request.body)) {
    body = request.body;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcInvocationType)) {
    realHeaders['X-Fc-Invocation-Type'] = Util.toJSONString(headers.xFcInvocationType);
  }
  if (!Util.isUnset(headers.xFcLogType)) {
    realHeaders['X-Fc-Log-Type'] = Util.toJSONString(headers.xFcLogType);
  }
  if (!Util.isUnset(headers.xFcStatefulAsyncInvocationEnable)) {
    realHeaders['X-Fc-Stateful-Async-Invocation-Enable'] = Util.toJSONString(headers.xFcStatefulAsyncInvocationEnable);
  }
  if (!Util.isUnset(headers.xFcStatefulAsyncInvocationId)) {
    realHeaders['X-Fc-Stateful-Async-Invocation-Id'] = Util.toJSONString(headers.xFcStatefulAsyncInvocationId);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
    body = body,
  };
  var params = new OpenApi.Params{
    action = 'InvokeFunction',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/invocations`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'byte',
    bodyType = 'byte',
  };
  return callApi(params, req, runtime);
}

async function invokeFunction(serviceName: string, functionName: string, request: InvokeFunctionRequest): InvokeFunctionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new InvokeFunctionHeaders{};
  return invokeFunctionWithOptions(serviceName, functionName, request, headers, runtime);
}

model ListAliasesHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='r9s89isisi****'),
}

model ListAliasesRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Default value: 20. Maximum value: 100. The number of returned resources is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of resources exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='caeba0be03****f84eb48b699f0a4883'),
  prefix?: string(name='prefix', description='The prefix that the names of returned resources must contain.', example='prefix_text'),
  startKey?: string(name='startKey', description='The starting position of the result list. The returned resources are sorted in alphabetical order, and the resources that include and follow the resource specified by the startKey parameter are returned.', example='nextkey'),
}

model ListAliasesResponseBody = {
  aliases?: [ 
    {
      additionalVersionWeight?: map[string]float(name='additionalVersionWeight', description='The additional version to which the alias points and the weight of the additional version.

*   The additional version takes effect only when the function is invoked.
*   The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.'),
      aliasName?: string(name='aliasName', description='The name of the alias.', example='test'),
      createdTime?: string(name='createdTime', description='The time when the ConfigMaps were created.', example='2016-08-15T16:06:05.000+0000'),
      description?: string(name='description', description='The description of the alias.', example='Sample alias.'),
      lastModifiedTime?: string(name='lastModifiedTime', description='The time at which the system parameter was last modified.', example='2016-08-15T16:06:05.000+0000'),
      resolvePolicy?: string(name='resolvePolicy', description='The canary release mode. Valid values:

*   **Random**: random canary release. This is the default value.
*   **Content**: rule-based canary release.', example='Random'),
      routePolicy?: RoutePolicy(name='routePolicy', description='The canary release rule. Traffic that meets the canary release rule is routed to the canary release instance.'),
      versionId?: string(name='versionId', description='The ID of the version.', example='1'),
    }
  ](name='aliases', description='The list of aliases.'),
  nextToken?: string(name='nextToken', description='The token used to obtain more results.', example='8bj81uI8n****'),
}

model ListAliasesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAliasesResponseBody(name='body'),
}

async function listAliasesWithOptions(serviceName: string, request: ListAliasesRequest, headers: ListAliasesHeaders, runtime: Util.RuntimeOptions): ListAliasesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.prefix)) {
    query['prefix'] = request.prefix;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAliases',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/aliases`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAliases(serviceName: string, request: ListAliasesRequest): ListAliasesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListAliasesHeaders{};
  return listAliasesWithOptions(serviceName, request, headers, runtime);
}

model ListCustomDomainsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the operation is called. The format is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='asdf*****'),
}

model ListCustomDomainsRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Valid values: \\[0,100]. Default value: 20. The number of returned results is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The pagination token to use to request the next page of results. If the number of resources exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='fc-thinkphp-demo.functioncompute.com'),
  prefix?: string(name='prefix', description='The prefix that the returned domain names must contain.', example='prefix_text'),
  startKey?: string(name='startKey', description='The returned resources are sorted in alphabetical order, and the resources that include and follow the resource specified by the startKey parameter are returned.', example='next_service'),
}

model ListCustomDomainsResponseBody = {
  customDomains?: [ 
    {
      accountId?: string(name='accountId', description='The ID of your Alibaba Cloud account.', example='1986114****4305'),
      apiVersion?: string(name='apiVersion', description='The version of the API.', example='2016-08-15'),
      certConfig?: CertConfig(name='certConfig', description='The configuration of the HTTPS certificate.'),
      createdTime?: string(name='createdTime', description='The time when the custom domain name was created.', example='2020-07-27T08:02:19Z'),
      domainName?: string(name='domainName', description='The endpoint.', example='example.com'),
      lastModifiedTime?: string(name='lastModifiedTime', description='The last time when the domain name was updated.', example='2020-07-27T08:02:19Z'),
      protocol?: string(name='protocol', description='The protocol type that is supported by the custom domain name. Valid values:

*   **HTTP**: Only HTTP is supported.
*   **HTTPS**: Only HTTPS is supported.
*   **HTTP,HTTPS**: Both HTTP and HTTPS are supported.', example='HTTP'),
      routeConfig?: RouteConfig(name='routeConfig', description='The configuration of the route table. The route table maps paths to functions when the functions are invoked by using custom domain names.'),
      tlsConfig?: TLSConfig(name='tlsConfig', description='The TLS configurations.'),
      wafConfig?: WAFConfig(name='wafConfig', description='Web Application Firewall (WAF) configurations.'),
    }
  ](name='customDomains', description='The information about custom domain names.'),
  nextToken?: string(name='nextToken', description='The pagination token to use to request the next page of results. If the number of resources exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='example.com'),
}

model ListCustomDomainsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListCustomDomainsResponseBody(name='body'),
}

async function listCustomDomainsWithOptions(request: ListCustomDomainsRequest, headers: ListCustomDomainsHeaders, runtime: Util.RuntimeOptions): ListCustomDomainsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.prefix)) {
    query['prefix'] = request.prefix;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCustomDomains',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/custom-domains`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCustomDomains(request: ListCustomDomainsRequest): ListCustomDomainsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListCustomDomainsHeaders{};
  return listCustomDomainsWithOptions(request, headers, runtime);
}

model ListEventSourcesHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model ListEventSourcesRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
}

model ListEventSourcesResponseBody = {
  eventSources?: [ 
    {
      createdTime?: string(name='createdTime', description='The time when the event source was created.', example='2016-08-15T16:06:05.000+0000'),
      sourceArn?: string(name='sourceArn', description='The Alibaba Cloud Resource Name (ARN) of the event source.', example='acs:eventbridge:cn-shanghai:123456:eventbus/mns-test/rule/fc-test1/target/abc'),
    }
  ](name='eventSources', description='The event sources.'),
}

model ListEventSourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEventSourcesResponseBody(name='body'),
}

async function listEventSourcesWithOptions(serviceName: string, functionName: string, request: ListEventSourcesRequest, headers: ListEventSourcesHeaders, runtime: Util.RuntimeOptions): ListEventSourcesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListEventSources',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/event-sources`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listEventSources(serviceName: string, functionName: string, request: ListEventSourcesRequest): ListEventSourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListEventSourcesHeaders{};
  return listEventSourcesWithOptions(serviceName, functionName, request, headers, runtime);
}

model ListFunctionAsyncInvokeConfigsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcCodeChecksum?: string(name='X-Fc-Code-Checksum', description='The CRC-64 value of the function code package. This value is used to check data integrity. The value is automatically calculated by the tool.', example='1506052139770049xxxx'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the Function Compute is called. The format is **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcInvocationType?: string(name='X-Fc-Invocation-Type', description='The invocation method.

*   **Sync**: synchronous
*   **Async**: asynchronous', example='Async'),
  xFcLogType?: string(name='X-Fc-Log-Type', description='The method used to return logs. Valid values:

*   **Tail**: returns the last 4 KB of logs that are generated for the current request.
*   **None**: No logs are returned for the current request. Default value: None.', example='Tail'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='asdf****'),
}

model ListFunctionAsyncInvokeConfigsRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Default value: 20. The value cannot exceed 100. The number of returned configurations is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of resources exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='8bj81uI8n****'),
}

model ListFunctionAsyncInvokeConfigsResponseBody = {
  configs?: [ 
    {
      createdTime?: string(name='createdTime', description='The time when the application was created.', example='2020-09-10T02:45:02Z'),
      destinationConfig?: DestinationConfig(name='destinationConfig', description='The configuration structure of the destination for the asynchronous invocation. If you have not configured this parameter, this parameter is null.', example='{"onSuccess": null,"onFailure": {"destination": "acs:mns:cn-shanghai:123:/queues/xxx/messages"}}'),
      function?: string(name='function', description='The function name.', example='helloworld'),
      lastModifiedTime?: string(name='lastModifiedTime', description='The time when the configuration was last modified.', example='2020-09-10T02:45:02Z'),
      maxAsyncEventAgeInSeconds?: long(name='maxAsyncEventAgeInSeconds', description='The maximum validity period of messages. If you have not configured this parameter, this parameter is null.', example='300'),
      maxAsyncRetryAttempts?: long(name='maxAsyncRetryAttempts', description='The maximum number of retries allowed after an asynchronous invocation fails. If you have not configured this parameter, this parameter is null.', example='3'),
      qualifier?: string(name='qualifier', description='The version or alias of the service.', example='test'),
      service?: string(name='service', description='The name of the service.', example='demo-service'),
      statefulInvocation?: boolean(name='statefulInvocation', description='Specifies whether to enable the asynchronous task feature.

*   **true**
*   **false**

If you have not configured this parameter, this parameter is null.', example='true'),
    }
  ](name='configs', description='The list of asynchronous invocation configurations.'),
  nextToken?: string(name='nextToken', description='The token used to obtain more results.', example='caeba0be03****f84eb48b699f0a4883'),
}

model ListFunctionAsyncInvokeConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFunctionAsyncInvokeConfigsResponseBody(name='body'),
}

/**
  * StatefulAsyncInvocation indicates whether the asynchronous task feature is enabled. If StatefulAsyncInvocation is set to true, the asynchronous task is enabled. All asynchronous invocations to the function corresponding to this configuration change to asynchronous task mode.
  *
  * @param request ListFunctionAsyncInvokeConfigsRequest
  * @param headers ListFunctionAsyncInvokeConfigsHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListFunctionAsyncInvokeConfigsResponse
 */
async function listFunctionAsyncInvokeConfigsWithOptions(serviceName: string, functionName: string, request: ListFunctionAsyncInvokeConfigsRequest, headers: ListFunctionAsyncInvokeConfigsHeaders, runtime: Util.RuntimeOptions): ListFunctionAsyncInvokeConfigsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcCodeChecksum)) {
    realHeaders['X-Fc-Code-Checksum'] = Util.toJSONString(headers.xFcCodeChecksum);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcInvocationType)) {
    realHeaders['X-Fc-Invocation-Type'] = Util.toJSONString(headers.xFcInvocationType);
  }
  if (!Util.isUnset(headers.xFcLogType)) {
    realHeaders['X-Fc-Log-Type'] = Util.toJSONString(headers.xFcLogType);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFunctionAsyncInvokeConfigs',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/async-invoke-configs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * StatefulAsyncInvocation indicates whether the asynchronous task feature is enabled. If StatefulAsyncInvocation is set to true, the asynchronous task is enabled. All asynchronous invocations to the function corresponding to this configuration change to asynchronous task mode.
  *
  * @param request ListFunctionAsyncInvokeConfigsRequest
  * @return ListFunctionAsyncInvokeConfigsResponse
 */
async function listFunctionAsyncInvokeConfigs(serviceName: string, functionName: string, request: ListFunctionAsyncInvokeConfigsRequest): ListFunctionAsyncInvokeConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListFunctionAsyncInvokeConfigsHeaders{};
  return listFunctionAsyncInvokeConfigsWithOptions(serviceName, functionName, request, headers, runtime);
}

model ListFunctionsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The format is **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='rid281s******'),
}

model ListFunctionsRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Default value: 20. Maximum value: 100. The number of returned resources is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of resources exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='8bj81uI8n****'),
  prefix?: string(name='prefix', description='The prefix that the names of returned resources must contain.', example='demoFunctionsPrefix'),
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
  startKey?: string(name='startKey', description='The starting position of the result list. The returned resources are sorted in alphabetical order, and the resources that include and follow the resource specified by the startKey parameter are returned.', example='demoStartKey'),
}

model ListFunctionsResponseBody = {
  functions?: [ 
    {
      caPort?: int32(name='caPort', description='The port on which the HTTP server listens for the custom runtime or custom container runtime.', example='9000'),
      codeChecksum?: string(name='codeChecksum', description='The CRC-64 value of the function code package.', example='5434025278388143772'),
      codeSize?: long(name='codeSize', description='The size of the function code package that is returned by the system. Unit: bytes.', example='1024'),
      cpu?: float(name='cpu', description='The number of vCPUs of the function. The value must be a multiple of 0.05.', example='1.5'),
      createdTime?: string(name='createdTime', description='The time when the function was created.', example='2016-08-15T15:00:00.000+0000'),
      customContainerConfig?: CustomContainerConfig(name='customContainerConfig', description='The configurations of the custom container runtime.'),
      customDNS?: CustomDNS(name='customDNS'),
      customHealthCheckConfig?: CustomHealthCheckConfig(name='customHealthCheckConfig', description='The custom health check configuration of the function. This parameter is applicable only to custom runtimes and custom containers.'),
      customRuntimeConfig?: CustomRuntimeConfig(name='customRuntimeConfig'),
      description?: string(name='description', description='The description of the function.', example='This is a demo hello world function'),
      diskSize?: int32(name='diskSize', description='The disk size of the function. Unit: MB. Valid values: 512 and 10240.', example='512'),
      environmentVariables?: map[string]string(name='environmentVariables', description='The environment variables that you configured for the function. You can obtain the values of the environment variables from the function.'),
      functionId?: string(name='functionId', description='The unique ID that is generated by the system for the function.', example='2d28e0e9-9ba5-4eed-8b1a-d3d9cd24****'),
      functionName?: string(name='functionName', description='The name of the function.', example='demo-function'),
      gpuMemorySize?: int32(name='gpuMemorySize', description='The GPU memory capacity for the function. Unit: MB. The value is a multiple of 1,024.', example='2048'),
      handler?: string(name='handler', description='The handler of the function.', example='index.handler'),
      initializationTimeout?: int32(name='initializationTimeout', description='The timeout period for the execution of the Initializer hook. Unit: seconds. Default value: 3. Valid values: 1 to 300. When this period ends, the execution of the Initializer hook is terminated.', example='60'),
      initializer?: string(name='initializer', description='The handler of the Initializer hook. The format of the value is determined by the programming language that you use. For more information, see [Initializer hook](~~157704~~).', example='index.handler'),
      instanceConcurrency?: int32(name='instanceConcurrency', description='The number of requests that can be concurrently processed by a single instance.', example='10'),
      instanceLifecycleConfig?: InstanceLifecycleConfig(name='instanceLifecycleConfig', description='The lifecycle configurations of the instance.'),
      instanceSoftConcurrency?: int32(name='instanceSoftConcurrency', description='The soft concurrency of the instance. You can use this parameter to implement graceful scale-up of instances. If the number of concurrent requests on an instance is greater than the value of soft concurrency, an instance scale-up is triggered. For example, if your instance requires a long time to start, you can specify a suitable soft concurrency to start the instance in advance.

The value must be less than or equal to that of the **instanceConcurrency** parameter.', example='5'),
      instanceType?: string(name='instanceType', description='The instance type of the function. Valid values:

*   **e1**: elastic instance
*   **c1**: performance instance
*   **fc.gpu.tesla.1**: GPU-accelerated instance (Tesla T4)
*   **fc.gpu.ampere.1**: GPU-accelerated instance (Ampere A10)
*   **g1**: same as fc.gpu.tesla.1', example='e1'),
      lastModifiedTime?: string(name='lastModifiedTime', description='The time when the function was last modified.', example='2016-08-15T17:00:00.000+0000'),
      layers?: [ string ](name='layers', description='The information about layers.

> Multiple layers are merged based on the order of array subscripts. The content of a layer with a smaller subscript overwrites the file that has the same name as a layer with a larger subscript.'),
      layersArnV2?: [ string ](name='layersArnV2'),
      memorySize?: int32(name='memorySize', description='The memory size that is configured for the function. Unit: MB.', example='512'),
      runtime?: string(name='runtime', description='The runtime environment of the function. Valid values: **nodejs16**, **nodejs14**, **nodejs12**, **nodejs10**, **nodejs8**, **nodejs6**, **nodejs4.4**, **python3.10**, **python3.9**, **python3**, **python2.7**, **java11**, **java8**, **go1**, **php7.2**, **dotnetcore3.1**, **dotnetcore2.1**, **custom.debian10**, **custom**, and **custom-container**. For more information, see [Supported function runtime environments](~~73338~~).', example='python3.9'),
      timeout?: int32(name='timeout', description='The timeout period for the execution of the function. Unit: seconds. Default value: 60. Valid values: 1 to 600. When this period expires, the execution of the function is terminated.', example='10'),
    }
  ](name='functions', description='The information about functions.'),
  nextToken?: string(name='nextToken', description='The token used to obtain more results. If this parameter is not returned, all the layers are returned.', example='8bj81uI8n****'),
}

model ListFunctionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFunctionsResponseBody(name='body'),
}

async function listFunctionsWithOptions(serviceName: string, request: ListFunctionsRequest, headers: ListFunctionsHeaders, runtime: Util.RuntimeOptions): ListFunctionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.prefix)) {
    query['prefix'] = request.prefix;
  }
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFunctions',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listFunctions(serviceName: string, request: ListFunctionsRequest): ListFunctionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListFunctionsHeaders{};
  return listFunctionsWithOptions(serviceName, request, headers, runtime);
}

model ListInstancesHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
}

model ListInstancesRequest {
  instanceIds?: [ string ](name='instanceIds', description='The instance ID.'),
  limit?: int32(name='limit', description='The maximum number of resources to return. Valid values: \\[0,1000].

The number of returned resources is less than or equal to the specified number.', example='20'),
  qualifier?: string(name='qualifier', description='The version or alias.', example='dev'),
}

model ListInstancesResponseBody = {
  instances?: [ 
    {
      instanceId?: string(name='instanceId', description='The instance ID.', example='1ef6b6ff-7f7b-485e-ab49-501ac681****'),
      versionId?: string(name='versionId', description='The version of service to which the instance belongs. If the instance belongs to the LATEST alias, 0 is returned as the version.', example='1'),
    }
  ](name='instances', description='The information about instances.'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
  * The ListInstances operation allows you to query available instances of a function.
  * Available instances are instances that are processing requests or can be scheduled to process requests. Available instances queried by the ListInstances operation are the same as the active instances queried by using the InvokeFunction operation if values of `ServiceName`, `FunctionName`, and `Qualifier` are the same.
  *
  * @param request ListInstancesRequest
  * @param headers ListInstancesHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListInstancesResponse
 */
async function listInstancesWithOptions(serviceName: string, functionName: string, request: ListInstancesRequest, headers: ListInstancesHeaders, runtime: Util.RuntimeOptions): ListInstancesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.instanceIds)) {
    query['instanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstances',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/instances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * The ListInstances operation allows you to query available instances of a function.
  * Available instances are instances that are processing requests or can be scheduled to process requests. Available instances queried by the ListInstances operation are the same as the active instances queried by using the InvokeFunction operation if values of `ServiceName`, `FunctionName`, and `Qualifier` are the same.
  *
  * @param request ListInstancesRequest
  * @return ListInstancesResponse
 */
async function listInstances(serviceName: string, functionName: string, request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListInstancesHeaders{};
  return listInstancesWithOptions(serviceName, functionName, request, headers, runtime);
}

model ListLayerVersionsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the operation is called. The format is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='rid281s******'),
}

model ListLayerVersionsRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Default value: 20. The value cannot exceed 100. The number of returned configurations is less than or equal to the specified number.', example='20'),
  startVersion?: int32(name='startVersion', description='The initial version of the layer.', example='1'),
}

model ListLayerVersionsResponseBody = {
  layers?: [
    Layer
  ](name='layers', description='The information about layer versions.'),
  nextVersion?: int32(name='nextVersion', description='The initial version of the layer for the next query.', example='21'),
}

model ListLayerVersionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListLayerVersionsResponseBody(name='body'),
}

async function listLayerVersionsWithOptions(layerName: string, request: ListLayerVersionsRequest, headers: ListLayerVersionsHeaders, runtime: Util.RuntimeOptions): ListLayerVersionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.startVersion)) {
    query['startVersion'] = request.startVersion;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLayerVersions',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/layers/${OpenApiUtil.getEncodeParam(layerName)}/versions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLayerVersions(layerName: string, request: ListLayerVersionsRequest): ListLayerVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListLayerVersionsHeaders{};
  return listLayerVersionsWithOptions(layerName, request, headers, runtime);
}

model ListLayersHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The format is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='rid281s******'),
}

model ListLayersRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Default value: 20. Maximum value: 100. The number of returned configurations is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of resources exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='next-layer-name'),
  official?: boolean(name='official', description='Specifies whether to obtain the official public layer. When the official parameter is set to true, the public field does not take effect. The default value is false.', example='true'),
  prefix?: string(name='prefix', description='The name prefix of the layer. The names of returned resources must contain the prefix. If the name prefix is a, the names of returned resources must start with a.', example='prefix-Layer'),
  public?: boolean(name='public', description='Specifies whether to obtain only the common layer. Default value: false.', example='true'),
  startKey?: string(name='startKey', description='The name of the start layer. The returned layers are sorted in alphabetical order, and the layers that include and follow the layer specified by the startKey parameter are returned.', example='start-layer-name'),
}

model ListLayersResponseBody = {
  layers?: [
    Layer
  ](name='layers', description='The layers.'),
  nextToken?: string(name='nextToken', description='The name of the start layer for the next query, which is also the token used to obtain more results.', example='next-layer-name'),
}

model ListLayersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListLayersResponseBody(name='body'),
}

async function listLayersWithOptions(request: ListLayersRequest, headers: ListLayersHeaders, runtime: Util.RuntimeOptions): ListLayersResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.official)) {
    query['official'] = request.official;
  }
  if (!Util.isUnset(request.prefix)) {
    query['prefix'] = request.prefix;
  }
  if (!Util.isUnset(request.public)) {
    query['public'] = request.public;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLayers',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/layers`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLayers(request: ListLayersRequest): ListLayersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListLayersHeaders{};
  return listLayersWithOptions(request, headers, runtime);
}

model ListOnDemandConfigsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='rid281s******'),
}

model ListOnDemandConfigsRequest {
  limit?: int32(name='limit', description='The maximum number of results to return. If this parameter is not set, 20 is returned by default, and the maximum value cannot exceed 100. The number of returned configurations is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of layers exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='8bj81uI8n****'),
  prefix?: string(name='prefix', description='The prefix that names of returned resources must contain. For example, if you set prefix to a, the names of returned resources must start with a.', example='prefix_text'),
  startKey?: string(name='startKey', description='The position from which the list begins. Results are sorted in alphabetical order and those results following startKey (inclusive) are listed.', example='nextservice'),
}

model ListOnDemandConfigsResponseBody = {
  configs?: [
    OnDemandConfig
  ](name='configs', description='The configurations of on-demand instances.'),
  nextToken?: string(name='nextToken', description='The pagination token that is used in the next request to retrieve a new page of results. If this parameter is not returned, all the layers are returned.', example='next_token'),
}

model ListOnDemandConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListOnDemandConfigsResponseBody(name='body'),
}

async function listOnDemandConfigsWithOptions(request: ListOnDemandConfigsRequest, headers: ListOnDemandConfigsHeaders, runtime: Util.RuntimeOptions): ListOnDemandConfigsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.prefix)) {
    query['prefix'] = request.prefix;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListOnDemandConfigs',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/on-demand-configs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listOnDemandConfigs(request: ListOnDemandConfigsRequest): ListOnDemandConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListOnDemandConfigsHeaders{};
  return listOnDemandConfigsWithOptions(request, headers, runtime);
}

model ListProvisionConfigsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='rid281s******'),
}

model ListProvisionConfigsRequest {
  limit?: long(name='limit', description='The maximum number of results to return. Default value: 20. Maximum value: 100. The number of returned resources is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. You do not need to specify this parameter in the first call. If a NextToken value is returned by a previous call, more results are available.', example='demoNextToken'),
  qualifier?: string(name='qualifier', description='The qualifier of the service to which resources belong. The qualifier must be aliasName and used together with the serviceName parameter.', example='prod'),
  serviceName?: string(name='serviceName', description='The name of the service to which resources belong.', example='serviceName'),
}

model ListProvisionConfigsResponseBody = {
  nextToken?: string(name='nextToken', description='The token used to obtain more results.', example='demoNextToken'),
  provisionConfigs?: [ 
    {
      alwaysAllocateCPU?: boolean(name='alwaysAllocateCPU', description='Specifies whether to always allocate CPU resources to function instances.', example='true'),
      current?: long(name='current', description='The number of current resources.', example='5'),
      currentError?: string(name='currentError', description='The error message returned if a provisioned instance fails to be created.', example='image not found'),
      resource?: string(name='resource', description='The description of the resource.', example='12345#servierName#qualifier#functionName'),
      scheduledActions?: [
        ScheduledActions
      ](name='scheduledActions', description='The configurations of scheduled auto scaling.'),
      target?: long(name='target', description='The expected number of resources.', example='5'),
      targetTrackingPolicies?: [
        TargetTrackingPolicies
      ](name='targetTrackingPolicies', description='The configurations of metric-based auto scaling.'),
    }
  ](name='provisionConfigs', description='The information about provisioned instances.'),
}

model ListProvisionConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListProvisionConfigsResponseBody(name='body'),
}

async function listProvisionConfigsWithOptions(request: ListProvisionConfigsRequest, headers: ListProvisionConfigsHeaders, runtime: Util.RuntimeOptions): ListProvisionConfigsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['serviceName'] = request.serviceName;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProvisionConfigs',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/provision-configs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listProvisionConfigs(request: ListProvisionConfigsRequest): ListProvisionConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListProvisionConfigsHeaders{};
  return listProvisionConfigsWithOptions(request, headers, runtime);
}

model ListReservedCapacitiesHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the Function Compute API is called. The format is **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='asdf****'),
}

model ListReservedCapacitiesRequest {
  limit?: string(name='limit', description='The maximum number of resources to return. Valid values: 1 to 100.', example='20'),
  nextToken?: string(name='nextToken', description='The token that determines the start point of the query.', example='8bj81uI8n****'),
}

model ListReservedCapacitiesResponseBody = {
  nextToken?: string(name='nextToken', description='The token used to obtain more results.', example='8bj81uI8n****'),
  reservedCapacities?: [
    OpenReservedCapacity
  ](name='reservedCapacities', description='The information about subscription instances.'),
}

model ListReservedCapacitiesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListReservedCapacitiesResponseBody(name='body'),
}

async function listReservedCapacitiesWithOptions(request: ListReservedCapacitiesRequest, headers: ListReservedCapacitiesHeaders, runtime: Util.RuntimeOptions): ListReservedCapacitiesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListReservedCapacities',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/reserved-capacities`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listReservedCapacities(request: ListReservedCapacitiesRequest): ListReservedCapacitiesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListReservedCapacitiesHeaders{};
  return listReservedCapacitiesWithOptions(request, headers, runtime);
}

model ListServiceVersionsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='rid281s******'),
}

model ListServiceVersionsRequest {
  direction?: string(name='direction', description='The order in which the returned versions are sorted. Valid values:

*   **FORWARD**: The results are sorted in ascending order.
*   **BACKWARD**: The results are sorted in descending order.', example='BACKWARD'),
  limit?: int32(name='limit', description='The maximum number of results to return. Default value: 20. Maximum value: 100. The number of returned configurations is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of layers exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='8bj81uI8n****'),
  startKey?: string(name='startKey', description='The position from which the list begins. Results are sorted based on the version numbers.', example='nextservice'),
}

model ListServiceVersionsResponseBody = {
  direction?: string(name='direction', description='The order in which the returned versions are sorted. Valid values:

*   **FORWARD**: The results are sorted in ascending order.
*   **BACKWARD**: The results are sorted in descending order.', example='BACKWARD'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of layers exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='eJhojW7N****'),
  versions?: [ 
    {
      createdTime?: string(name='createdTime', description='The time when the service version was created.', example='2020-03-16T06:23:50Z'),
      description?: string(name='description', description='The description of the service version.', example='test_description'),
      lastModifiedTime?: string(name='lastModifiedTime', description='The last time when the service version was updated.', example='2020-07-15T06:12:31Z'),
      versionId?: string(name='versionId', description='The version of the service.', example='1'),
    }
  ](name='versions', description='The versions.'),
}

model ListServiceVersionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListServiceVersionsResponseBody(name='body'),
}

async function listServiceVersionsWithOptions(serviceName: string, request: ListServiceVersionsRequest, headers: ListServiceVersionsHeaders, runtime: Util.RuntimeOptions): ListServiceVersionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.direction)) {
    query['direction'] = request.direction;
  }
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListServiceVersions',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/versions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listServiceVersions(serviceName: string, request: ListServiceVersionsRequest): ListServiceVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListServiceVersionsHeaders{};
  return listServiceVersionsWithOptions(serviceName, request, headers, runtime);
}

model ListServicesHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='rid281s******'),
}

model ListServicesRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Default value: 20. The value cannot exceed 100. The number of returned configurations is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The starting position of the query. If this parameter is left empty, the query starts from the beginning. You do not need to specify this parameter in the first query. If the number of asynchronous tasks exceeds the limit, the nextToken parameter is returned, the value of which can be used in subsequent calls to obtain more results.', example='caeba0****be03f84eb48b699f0a4883'),
  prefix?: string(name='prefix', description='The prefix that the names of returned resources must contain. If the name prefix is a, the names of returned resources must start with a.', example='prefix_text'),
  startKey?: string(name='startKey', description='The returned resources are sorted in alphabetical order, and the resources that include and follow the resource specified by the startKey parameter are returned.', example='nextService'),
}

model ListServicesResponseBody = {
  nextToken?: string(name='nextToken', description='The token used to obtain more results. If this parameter is left empty, all the results are returned.', example='caeba0****be03f84eb48b699f0a4883'),
  services?: [ 
    {
      createdTime?: string(name='createdTime', description='The time when the service was created.', example='2020-04-03T05:57:28Z'),
      description?: string(name='description', description='The description of the service.', example='test_description'),
      internetAccess?: boolean(name='internetAccess', description='Specifies whether to allow functions to access the Internet. Valid values:

*   **true**: allows functions in the specified service to access the Internet.
*   **false**: does not allow functions to access the Internet.', example='true'),
      lastModifiedTime?: string(name='lastModifiedTime', description='The time when the service was last modified.', example='2020-04-03T05:57:28Z'),
      logConfig?: LogConfig(name='logConfig', description='The log configuration, which specifies a Logstore to store function execution logs.'),
      nasConfig?: NASConfig(name='nasConfig', description='The configurations of the NAS file system. The configuration allows functions in the specified service in Function Compute to access the NAS file system.'),
      ossMountConfig?: OSSMountConfig(name='ossMountConfig', description='The OSS mount configurations.'),
      role?: string(name='role', description='The RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:

*   Sends function execution logs to your Logstore.
*   Generates a token for a function to access other cloud resources during function execution.', example='acs:ram::198613743****:role/fc-public-test'),
      serviceId?: string(name='serviceId', description='The unique ID generated by the system for the service.', example='c910061f-****-44e6-b659-***c'),
      serviceName?: string(name='serviceName', description='The name of the service.', example='service_name'),
      tracingConfig?: TracingConfig(name='tracingConfig', description='The configuration of Tracing Analysis. After you configure Tracing Analysis for a service in Function Compute, you can record the execution duration of a request, view the amount of cold start time for a function, and record the execution duration of a function. For more information, see [Overview](~~189804~~).'),
      useSLRAuthentication?: boolean(name='useSLRAuthentication'),
      vpcConfig?: VPCConfig(name='vpcConfig', description='The VPC configuration. The configuration allows a function to access the specified VPC.'),
    }
  ](name='services', description='The information about a service.'),
}

model ListServicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListServicesResponseBody(name='body'),
}

async function listServicesWithOptions(request: ListServicesRequest, headers: ListServicesHeaders, runtime: Util.RuntimeOptions): ListServicesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.prefix)) {
    query['prefix'] = request.prefix;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListServices',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listServices(request: ListServicesRequest): ListServicesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListServicesHeaders{};
  return listServicesWithOptions(request, headers, runtime);
}

model ListStatefulAsyncInvocationFunctionsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='12348*****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='duytnd-Xsdfasfd***'),
}

model ListStatefulAsyncInvocationFunctionsRequest {
  limit?: int32(name='limit', description='The maximum number of results to return. Default value: 20. Maximum value: 100. The number of returned configurations is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The starting position of the query. If this parameter is left empty, the query starts from the beginning. You do not need to specify this parameter in the first call. The tokens for subsequent queries are obtained from previous returned results.', example='""'),
}

model ListStatefulAsyncInvocationFunctionsResponseBody = {
  data?: [
    AsyncConfigMeta
  ](name='data', description='The details of returned data.'),
  nextToken?: string(name='nextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='""'),
}

model ListStatefulAsyncInvocationFunctionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListStatefulAsyncInvocationFunctionsResponseBody(name='body'),
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request ListStatefulAsyncInvocationFunctionsRequest
  * @param headers ListStatefulAsyncInvocationFunctionsHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListStatefulAsyncInvocationFunctionsResponse
 */
async function listStatefulAsyncInvocationFunctionsWithOptions(request: ListStatefulAsyncInvocationFunctionsRequest, headers: ListStatefulAsyncInvocationFunctionsHeaders, runtime: Util.RuntimeOptions): ListStatefulAsyncInvocationFunctionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListStatefulAsyncInvocationFunctions',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/stateful-async-invocation-functions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request ListStatefulAsyncInvocationFunctionsRequest
  * @return ListStatefulAsyncInvocationFunctionsResponse
 */
async function listStatefulAsyncInvocationFunctions(request: ListStatefulAsyncInvocationFunctionsRequest): ListStatefulAsyncInvocationFunctionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListStatefulAsyncInvocationFunctionsHeaders{};
  return listStatefulAsyncInvocationFunctionsWithOptions(request, headers, runtime);
}

model ListStatefulAsyncInvocationsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcCodeChecksum?: string(name='X-Fc-Code-Checksum', description='The CRC-64 value of the function code package. This value is used to check data integrity. The value is automatically calculated by the tool.', example='1506052139770049xxxx'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcInvocationType?: string(name='X-Fc-Invocation-Type', description='The method used to invoke the function.

*   **Sync**: synchronous invocations
*   **Async**: asynchronous invocations', example='Async'),
  xFcLogType?: string(name='X-Fc-Log-Type', description='The method used to return logs.

*   **Tail**: returns the last 4 KB of logs that are generated for the current request.
*   **None**: does not return logs for the current request. Default value: None.', example='Tail'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='abcxxx'),
}

model ListStatefulAsyncInvocationsRequest {
  includePayload?: boolean(name='includePayload', description='*   Specifies whether to return the invocationPayload parameter in the response. **true**: returns the `invocationPayload` parameter in the response.``
*   **false**: does not return the `invocationPayload` parameter in the response.``

>  The `invocationPayload` parameter indicates the input parameters of an asynchronous task.', example='true'),
  invocationIdPrefix?: string(name='invocationIdPrefix', description='The name prefix of the asynchronous tasks. This parameter is used to limit the names of the returned asynchronous tasks. For example, if you set the `invocationidPrefix` parameter to `job`, the names of the returned invocations must start with `job`.', example='abcxxx'),
  limit?: int32(name='limit', description='The maximum number of asynchronous tasks to be returned. Valid values: \\[1,100]. Default value: 50.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. You do not need to specify this parameter in the first call. If a NextToken value is returned by a previous call, more results are available.', example='caeba0****be03f84eb48b699f0a4883'),
  qualifier?: string(name='qualifier', description='The version or alias of the service to which the asynchronous task belongs.', example='LATEST'),
  sortOrderByTime?: string(name='sortOrderByTime', description='The method that you want to use to sort the returned asynchronous tasks.

*   **asc**: the ascending order
*   **desc**: the descending order', example='desc'),
  startedTimeBegin?: long(name='startedTimeBegin', description='The start time of the asynchronous task.', example='1640966400000'),
  startedTimeEnd?: long(name='startedTimeEnd', description='The end time of the asynchronous task.', example='1640966400000'),
  status?: string(name='status', description='The state of the asynchronous task.

*   **Enqueued**: The asynchronous task is enqueued and is waiting to be executed.
*   **Succeeded**: The invocation succeeded.
*   **Failed**: The invocation failed.
*   **Running**: The invocation is being executed.
*   **Stopped**: The invocation was terminated.
*   **Stopping**: The invocation is being terminated.
*   **Invalid**: The invocation is invalid and not executed due to specific reasons. For example, the function is deleted.
*   **Expired**: The maximum validity period of messages is specified for the asynchronous invocation. The invocation is discarded and not executed because the specified maximum validity period of messages elapsed.
*   **Retrying**: The asynchronous task is being retried due to an execution error.', example='Running'),
}

model ListStatefulAsyncInvocationsResponseBody = {
  invocations?: [
    StatefulAsyncInvocation
  ](name='invocations', description='The list of asynchronous tasks.'),
  nextToken?: string(name='nextToken', description='The token used to obtain more results. If this parameter is left empty, all the results are returned.', example='8bj81uI8n****'),
}

model ListStatefulAsyncInvocationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListStatefulAsyncInvocationsResponseBody(name='body'),
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request ListStatefulAsyncInvocationsRequest
  * @param headers ListStatefulAsyncInvocationsHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return ListStatefulAsyncInvocationsResponse
 */
async function listStatefulAsyncInvocationsWithOptions(serviceName: string, functionName: string, request: ListStatefulAsyncInvocationsRequest, headers: ListStatefulAsyncInvocationsHeaders, runtime: Util.RuntimeOptions): ListStatefulAsyncInvocationsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.includePayload)) {
    query['includePayload'] = request.includePayload;
  }
  if (!Util.isUnset(request.invocationIdPrefix)) {
    query['invocationIdPrefix'] = request.invocationIdPrefix;
  }
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }
  if (!Util.isUnset(request.sortOrderByTime)) {
    query['sortOrderByTime'] = request.sortOrderByTime;
  }
  if (!Util.isUnset(request.startedTimeBegin)) {
    query['startedTimeBegin'] = request.startedTimeBegin;
  }
  if (!Util.isUnset(request.startedTimeEnd)) {
    query['startedTimeEnd'] = request.startedTimeEnd;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcCodeChecksum)) {
    realHeaders['X-Fc-Code-Checksum'] = Util.toJSONString(headers.xFcCodeChecksum);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcInvocationType)) {
    realHeaders['X-Fc-Invocation-Type'] = Util.toJSONString(headers.xFcInvocationType);
  }
  if (!Util.isUnset(headers.xFcLogType)) {
    realHeaders['X-Fc-Log-Type'] = Util.toJSONString(headers.xFcLogType);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListStatefulAsyncInvocations',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/stateful-async-invocations`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request ListStatefulAsyncInvocationsRequest
  * @return ListStatefulAsyncInvocationsResponse
 */
async function listStatefulAsyncInvocations(serviceName: string, functionName: string, request: ListStatefulAsyncInvocationsRequest): ListStatefulAsyncInvocationsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListStatefulAsyncInvocationsHeaders{};
  return listStatefulAsyncInvocationsWithOptions(serviceName, functionName, request, headers, runtime);
}

model ListTaggedResourcesHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='my-test-trace-id'),
}

model ListTaggedResourcesRequest {
  limit?: int32(name='limit', description='The maximum number of results to return. Default value: 20. Maximum value: 100. The number of returned resources is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of layers exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='a-service'),
}

model ListTaggedResourcesResponseBody = {
  nextToken?: string(name='nextToken', description='The token required to obtain more results. If the number of layers exceeds the limit, the nextToken parameter is returned. You can include the parameter in subsequent calls to obtain more results. You do not need to provide this parameter in the first call.', example='a-service'),
  resources?: [
    Resource
  ](name='resources', description='The information about tagged services.'),
}

model ListTaggedResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTaggedResourcesResponseBody(name='body'),
}

async function listTaggedResourcesWithOptions(request: ListTaggedResourcesRequest, headers: ListTaggedResourcesHeaders, runtime: Util.RuntimeOptions): ListTaggedResourcesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTaggedResources',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/tags`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTaggedResources(request: ListTaggedResourcesRequest): ListTaggedResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListTaggedResourcesHeaders{};
  return listTaggedResourcesWithOptions(request, headers, runtime);
}

model ListTriggersHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the request is initiated on the client. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='my-test-trace-id'),
}

model ListTriggersRequest {
  limit?: int32(name='limit', description='The maximum number of resources to return. Default value: 20. Maximum value: 100. The number of returned resources is less than or equal to the specified number.', example='20'),
  nextToken?: string(name='nextToken', description='The token required to obtain more results. You do not need to provide this parameter in the first call. The tokens for subsequent queries are obtained from the returned results.', example='f-trigger'),
  prefix?: string(name='prefix', description='The prefix that the names of returned resources must contain.', example='a'),
  startKey?: string(name='startKey', description='The returned resources are sorted in alphabetical order, and the resources that include and follow the resource specified by the startKey parameter are returned.', example='a-trigger'),
}

model ListTriggersResponseBody = {
  nextToken?: string(name='nextToken', description='The token used to obtain more results. If this parameter is left empty, all the results are returned.', example='f-trigger'),
  triggers?: [ 
    {
      createdTime?: string(name='createdTime', description='The time when the trigger was created.', example='2016-08-15T15:00:00.000+0000'),
      description?: string(name='description', description='The description of the trigger.', example='trigger for test'),
      domainName?: string(name='domainName', description='The domain name used to invoke the function by using HTTP. You can add this domain name as the prefix to the endpoint of Function Compute. This way, you can invoke the function that corresponds to the trigger by using HTTP. Example: `{domainName}.cn-shanghai.fc.aliyuncs.com`.', example='demo-service-demo-function-jkhksh'),
      invocationRole?: string(name='invocationRole', description='The Alibaba Cloud Resource Name (ARN) of the RAM role that is used by the event source to invoke the function.', example='acs:ram::123456xxxx:role/fc-test'),
      lastModifiedTime?: string(name='lastModifiedTime', description='The time when the trigger was last modified.', example='016-08-15T17:00:00.000+0000'),
      qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
      sourceArn?: string(name='sourceArn', description='The ARN of the event source.', example='acs:oss:cn-shanghai:123456xxxx:mybucket'),
      triggerConfig?: string(name='triggerConfig', description='The configurations of the trigger. The configurations vary based on the trigger type. For more information about the format, see the following topics:

*   Object Storage Service (OSS) trigger: [OSSTriggerConfig](~~415697~~).
*   Simple Log Service trigger: [LogTriggerConfig](~~415694~~).
*   Time trigger: [TimeTriggerConfig](~~415712~~).
*   HTTP trigger: [HTTPTriggerConfig](~~415685~~).
*   Tablestore trigger: Specify the **SourceArn** parameter and leave this parameter empty.
*   Alibaba Cloud CDN event trigger: [CDNEventsTriggerConfig](~~73333~~).
*   MNS topic trigger: [MnsTopicTriggerConfig](~~415695~~).
*   EventBridge triggers: [EventBridgeTriggerConfig](~~333711~~).', example='{"events": ["oss:ObjectCreated:*"], "filter": {"key": {"prefix": "/prefix", "suffix": ".zip"}}}'),
      triggerId?: string(name='triggerId', description='The unique ID of the trigger.', example='3e270f2f-cef2-421a-bc86-ff4e8088****'),
      triggerName?: string(name='triggerName', description='The name of the trigger.', example='demoTrigger'),
      triggerType?: string(name='triggerType', description='The trigger type. Valid values: **oss**, **log**, **tablestore**, **timer**, **http**, **cdn_events**, **mns_topic**, and **eventbridge**.', example='oss'),
      urlInternet?: string(name='urlInternet', description='The public endpoint. You can access HTTP triggers over the Internet by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou.fcapp.run'),
      urlIntranet?: string(name='urlIntranet', description='The private endpoint. In a VPC, you can access HTTP triggers by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou-vpc.fcapp.run'),
    }
  ](name='triggers', description='The information about triggers.'),
}

model ListTriggersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTriggersResponseBody(name='body'),
}

async function listTriggersWithOptions(serviceName: string, functionName: string, request: ListTriggersRequest, headers: ListTriggersHeaders, runtime: Util.RuntimeOptions): ListTriggersResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.limit)) {
    query['limit'] = request.limit;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.prefix)) {
    query['prefix'] = request.prefix;
  }
  if (!Util.isUnset(request.startKey)) {
    query['startKey'] = request.startKey;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTriggers',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/triggers`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTriggers(serviceName: string, functionName: string, request: ListTriggersRequest): ListTriggersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListTriggersHeaders{};
  return listTriggersWithOptions(serviceName, functionName, request, headers, runtime);
}

model ListVpcBindingsHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when Function Compute API is called. Specify the time in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='rid281s******'),
}

model ListVpcBindingsResponseBody = {
  vpcIds?: [ string ](name='vpcIds', description='The IDs of bound VPCs.'),
}

model ListVpcBindingsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListVpcBindingsResponseBody(name='body'),
}

async function listVpcBindingsWithOptions(serviceName: string, headers: ListVpcBindingsHeaders, runtime: Util.RuntimeOptions): ListVpcBindingsResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'ListVpcBindings',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/bindings`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listVpcBindings(serviceName: string): ListVpcBindingsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ListVpcBindingsHeaders{};
  return listVpcBindingsWithOptions(serviceName, headers, runtime);
}

model PublishServiceVersionHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='The ETag value of the service. This value is used to ensure that the modified service is consistent with the service to be modified. The ETag value is returned in the responses of the [CreateService](~~175256~~), [UpdateService](~~188167~~), and [GetService](~~189225~~) operations.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The start time when the function is invoked. Specify the time in the yyyy-mm-ddhh:mm:ss format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='2020-12-1210:00:00', example='rid281s******'),
}

model PublishServiceVersionRequest {
  description?: string(name='description', description='The description of the service version.', example='test_description'),
}

model PublishServiceVersionResponseBody = {
  createdTime?: string(name='createdTime', description='The returned data.', example='2016-08-15T16:06:05.000+0000'),
  description?: string(name='description', description='The creation time.', example='test_description'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The description of the service version.', example='2016-08-15T16:06:05.000+0000'),
  versionId?: string(name='versionId', description='The last update time.', example='1'),
}

model PublishServiceVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PublishServiceVersionResponseBody(name='body'),
}

async function publishServiceVersionWithOptions(serviceName: string, request: PublishServiceVersionRequest, headers: PublishServiceVersionHeaders, runtime: Util.RuntimeOptions): PublishServiceVersionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PublishServiceVersion',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/versions`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function publishServiceVersion(serviceName: string, request: PublishServiceVersionRequest): PublishServiceVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new PublishServiceVersionHeaders{};
  return publishServiceVersionWithOptions(serviceName, request, headers, runtime);
}

model PutFunctionAsyncInvokeConfigHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The name of the service.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The creation time.', example='The information about the asynchronous invocation configuration.'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The maximum number of retries allowed after an asynchronous invocation fails. Default value: 3. Valid values: 0 to 8.', example='ksdfjkdmkki***'),
}

model PutFunctionAsyncInvokeConfigRequest {
  destinationConfig?: DestinationConfig(name='destinationConfig', description='You can search for API operations, call and debug API operations online, and dynamically generate executable sample code for SDKs.'),
  maxAsyncEventAgeInSeconds?: long(name='maxAsyncEventAgeInSeconds', description='Alibaba Cloud CLI', example='300'),
  maxAsyncRetryAttempts?: long(name='maxAsyncRetryAttempts', description='The information about the asynchronous invocation configuration.', example='3'),
  statefulInvocation?: boolean(name='statefulInvocation', description='The version or alias of the service.', example='true'),
  qualifier?: string(name='qualifier', description='The latest version of Function Compute API.', example='test'),
}

model PutFunctionAsyncInvokeConfigResponseBody = {
  createdTime?: string(name='createdTime', description='Sat, 14 Jul 2017 07:02:38 GMT', example='2020-09-10T02:45:02Z'),
  destinationConfig?: DestinationConfig(name='destinationConfig', description='The trace ID of the invocation request of Function Compute.', example='{"onSuccess": null,"onFailure": {"destination": "acs:mns:cn-shanghai:123:/queues/xxx/messages"}}'),
  function?: string(name='function', description='The name of the function.', example='helloworld'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The configuration structure of the destination for asynchronous invocation.', example='2020-09-10T02:45:02Z'),
  maxAsyncEventAgeInSeconds?: long(name='maxAsyncEventAgeInSeconds', description='Specifies whether to enable the asynchronous task feature. 

- **true**: enables the asynchronous task feature. 
- **false**: does not enable the asynchronous task feature.', example='300'),
  maxAsyncRetryAttempts?: long(name='maxAsyncRetryAttempts', description='The ID of your Alibaba Cloud account.', example='3'),
  qualifier?: string(name='qualifier', description='Specifies whether to enable the asynchronous task feature. 

- **true**: enables the asynchronous task feature. 
- **false**: does not enable the asynchronous task feature.', example='test'),
  service?: string(name='service', description='Creates or modifies an asynchronous invocation configuration for a function.', example='demo-service'),
  statefulInvocation?: boolean(name='statefulInvocation', description='Jianyi', example='true'),
}

model PutFunctionAsyncInvokeConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PutFunctionAsyncInvokeConfigResponseBody(name='body'),
}

/**
  * The maximum validity period of messages.
  *
  * @param request PutFunctionAsyncInvokeConfigRequest
  * @param headers PutFunctionAsyncInvokeConfigHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return PutFunctionAsyncInvokeConfigResponse
 */
async function putFunctionAsyncInvokeConfigWithOptions(serviceName: string, functionName: string, request: PutFunctionAsyncInvokeConfigRequest, headers: PutFunctionAsyncInvokeConfigHeaders, runtime: Util.RuntimeOptions): PutFunctionAsyncInvokeConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.destinationConfig)) {
    body['destinationConfig'] = request.destinationConfig;
  }
  if (!Util.isUnset(request.maxAsyncEventAgeInSeconds)) {
    body['maxAsyncEventAgeInSeconds'] = request.maxAsyncEventAgeInSeconds;
  }
  if (!Util.isUnset(request.maxAsyncRetryAttempts)) {
    body['maxAsyncRetryAttempts'] = request.maxAsyncRetryAttempts;
  }
  if (!Util.isUnset(request.statefulInvocation)) {
    body['statefulInvocation'] = request.statefulInvocation;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PutFunctionAsyncInvokeConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/async-invoke-config`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * The maximum validity period of messages.
  *
  * @param request PutFunctionAsyncInvokeConfigRequest
  * @return PutFunctionAsyncInvokeConfigResponse
 */
async function putFunctionAsyncInvokeConfig(serviceName: string, functionName: string, request: PutFunctionAsyncInvokeConfigRequest): PutFunctionAsyncInvokeConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new PutFunctionAsyncInvokeConfigHeaders{};
  return putFunctionAsyncInvokeConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model PutFunctionOnDemandConfigHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='If the ETag specified in the request matches the ETag value of the object, the object and 200 OK are returned. Otherwise, 412 Precondition Failed is returned.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The unique ID of the trace.', example='r9s89isisi****'),
}

model PutFunctionOnDemandConfigRequest {
  maximumInstanceCount?: long(name='maximumInstanceCount', description='The maximum number of on-demand instances. For more information, see [Configure provisioned instances and auto scaling rules](~~185038~~).', example='10'),
  qualifier?: string(name='qualifier', description='The service alias or latest version. Other versions are not supported.', example='prod'),
}

model PutFunctionOnDemandConfigResponseBody = {
  maximumInstanceCount?: long(name='maximumInstanceCount', description='The maximum number of instances.', example='10'),
  resource?: string(name='resource', description='The description of the resource.', example='12345#servierName#qualifier#functionName'),
}

model PutFunctionOnDemandConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PutFunctionOnDemandConfigResponseBody(name='body'),
}

async function putFunctionOnDemandConfigWithOptions(serviceName: string, functionName: string, request: PutFunctionOnDemandConfigRequest, headers: PutFunctionOnDemandConfigHeaders, runtime: Util.RuntimeOptions): PutFunctionOnDemandConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.maximumInstanceCount)) {
    body['maximumInstanceCount'] = request.maximumInstanceCount;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PutFunctionOnDemandConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/on-demand-config`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putFunctionOnDemandConfig(serviceName: string, functionName: string, request: PutFunctionOnDemandConfigRequest): PutFunctionOnDemandConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new PutFunctionOnDemandConfigHeaders{};
  return putFunctionOnDemandConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model PutLayerACLHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the operation is called. The format is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model PutLayerACLRequest {
  public?: boolean(name='public', description='Specifies whether the layer is public.

*   **true**: Public.
*   **false**: Not public.', example='true'),
}

model PutLayerACLResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function putLayerACLWithOptions(layerName: string, request: PutLayerACLRequest, headers: PutLayerACLHeaders, runtime: Util.RuntimeOptions): PutLayerACLResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.public)) {
    query['public'] = request.public;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PutLayerACL',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/layers/${OpenApiUtil.getEncodeParam(layerName)}/acl`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function putLayerACL(layerName: string, request: PutLayerACLRequest): PutLayerACLResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new PutLayerACLHeaders{};
  return putLayerACLWithOptions(layerName, request, headers, runtime);
}

model PutProvisionConfigHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value follows the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='rid281s******'),
}

model PutProvisionConfigRequest {
  alwaysAllocateCPU?: boolean(name='alwaysAllocateCPU', description='Specifies whether to always allocate CPU resources. Default value: true.', example='true'),
  scheduledActions?: [
    ScheduledActions
  ](name='scheduledActions', description='The configurations of scheduled auto scaling.'),
  target?: long(name='target', description='The number of target provisioned instances. Valid values: \\[0,10000].', example='1'),
  targetTrackingPolicies?: [
    TargetTrackingPolicies
  ](name='targetTrackingPolicies', description='The configurations of metric-based auto scaling.'),
  qualifier?: string(name='qualifier', description='The service alias or latest version. Other versions are not supported.', example='prod'),
}

model PutProvisionConfigResponseBody = {
  alwaysAllocateCPU?: boolean(name='alwaysAllocateCPU', description='Specifies whether to always allocate CPU to a function instance.', example='true'),
  current?: long(name='current', description='The actual number of provisioned instances.', example='1'),
  resource?: string(name='resource', description='The description of the resource.', example='"12345#servierName#qualifier#functionName"'),
  scheduledActions?: [
    ScheduledActions
  ](name='scheduledActions', description='The configurations of scheduled auto scaling.'),
  target?: long(name='target', description='The number of target provisioned instances.', example='5'),
  targetTrackingPolicies?: [
    TargetTrackingPolicies
  ](name='targetTrackingPolicies', description='The configurations of metric-based auto scaling.'),
}

model PutProvisionConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PutProvisionConfigResponseBody(name='body'),
}

async function putProvisionConfigWithOptions(serviceName: string, functionName: string, request: PutProvisionConfigRequest, headers: PutProvisionConfigHeaders, runtime: Util.RuntimeOptions): PutProvisionConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.alwaysAllocateCPU)) {
    body['alwaysAllocateCPU'] = request.alwaysAllocateCPU;
  }
  if (!Util.isUnset(request.scheduledActions)) {
    body['scheduledActions'] = request.scheduledActions;
  }
  if (!Util.isUnset(request.target)) {
    body['target'] = request.target;
  }
  if (!Util.isUnset(request.targetTrackingPolicies)) {
    body['targetTrackingPolicies'] = request.targetTrackingPolicies;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'PutProvisionConfig',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/provision-config`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function putProvisionConfig(serviceName: string, functionName: string, request: PutProvisionConfigRequest): PutProvisionConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new PutProvisionConfigHeaders{};
  return putProvisionConfigWithOptions(serviceName, functionName, request, headers, runtime);
}

model RegisterEventSourceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model RegisterEventSourceRequest {
  sourceArn?: string(name='sourceArn', description='The Alibaba Cloud Resource Name (ARN) of the event source.', example='acs:eventbridge:cn-shanghai:123456:eventbus/mns-test/rule/fc-test1/target/abc'),
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
}

model RegisterEventSourceResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the event source was created.', example='2016-08-15T16:06:05.000+0000'),
  sourceArn?: string(name='sourceArn', description='The Alibaba Cloud Resource Name (ARN) of the event source.', example='acs:eventbridge:cn-shanghai:123456:eventbus/mns-test/rule/fc-test1/target/abc'),
}

model RegisterEventSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RegisterEventSourceResponseBody(name='body'),
}

async function registerEventSourceWithOptions(serviceName: string, functionName: string, request: RegisterEventSourceRequest, headers: RegisterEventSourceHeaders, runtime: Util.RuntimeOptions): RegisterEventSourceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var body : map[string]any = {};
  if (!Util.isUnset(request.sourceArn)) {
    body['sourceArn'] = request.sourceArn;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RegisterEventSource',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/event-sources`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function registerEventSource(serviceName: string, functionName: string, request: RegisterEventSourceRequest): RegisterEventSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new RegisterEventSourceHeaders{};
  return registerEventSourceWithOptions(serviceName, functionName, request, headers, runtime);
}

model ReleaseGPUInstanceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The format of the value is: EEE,d MMM yyyy HH:mm:ss GMT.', example='2022-11-11 07:31:04.899465017 +0000 UTC m=+37.671563424'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='test-trace-id'),
}

model ReleaseGPUInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function releaseGPUInstanceWithOptions(instanceId: string, headers: ReleaseGPUInstanceHeaders, runtime: Util.RuntimeOptions): ReleaseGPUInstanceResponse {
  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
  };
  var params = new OpenApi.Params{
    action = 'ReleaseGPUInstance',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/gpuInstances/${OpenApiUtil.getEncodeParam(instanceId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function releaseGPUInstance(instanceId: string): ReleaseGPUInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new ReleaseGPUInstanceHeaders{};
  return releaseGPUInstanceWithOptions(instanceId, headers, runtime);
}

model StopStatefulAsyncInvocationHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Sat, 14 Jul 2017 07:02:38 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the request for Function Compute API.', example='asdf****'),
}

model StopStatefulAsyncInvocationRequest {
  qualifier?: string(name='qualifier', description='The version or alias of the service to which the asynchronous task belongs.', example='LATEST'),
}

model StopStatefulAsyncInvocationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request StopStatefulAsyncInvocationRequest
  * @param headers StopStatefulAsyncInvocationHeaders
  * @param runtime runtime options for this request RuntimeOptions
  * @return StopStatefulAsyncInvocationResponse
 */
async function stopStatefulAsyncInvocationWithOptions(serviceName: string, functionName: string, invocationId: string, request: StopStatefulAsyncInvocationRequest, headers: StopStatefulAsyncInvocationHeaders, runtime: Util.RuntimeOptions): StopStatefulAsyncInvocationResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.qualifier)) {
    query['qualifier'] = request.qualifier;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopStatefulAsyncInvocation',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/stateful-async-invocations/${OpenApiUtil.getEncodeParam(invocationId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

/**
  * StatefulAsyncInvocation represents asynchronous tasks. Asynchronous tasks (StatefulAsyncInvocation) allow you to manage the states of asynchronous invocations. The asynchronous task feature is more suitable for task scenarios.
  *
  * @param request StopStatefulAsyncInvocationRequest
  * @return StopStatefulAsyncInvocationResponse
 */
async function stopStatefulAsyncInvocation(serviceName: string, functionName: string, invocationId: string, request: StopStatefulAsyncInvocationRequest): StopStatefulAsyncInvocationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new StopStatefulAsyncInvocationHeaders{};
  return stopStatefulAsyncInvocationWithOptions(serviceName, functionName, invocationId, request, headers, runtime);
}

model TagResourceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The format is **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='my-test-trace-id'),
}

model TagResourceRequest {
  resourceArn?: string(name='resourceArn', description='The ARN of the resource.

> You can use the value of this parameter to query the information about the resource, such as the account, service, and region information of the resource. You can manage tags only for services for top level resources.', example='acs:fc:cn-shanghai:188077086902****:services/demo'),
  tags?: map[string]string(name='tags', description='The tag dictionary.', example='{"k1":"v1"}'),
}

model TagResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function tagResourceWithOptions(request: TagResourceRequest, headers: TagResourceHeaders, runtime: Util.RuntimeOptions): TagResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.resourceArn)) {
    body['resourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.tags)) {
    body['tags'] = request.tags;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TagResource',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/tag`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function tagResource(request: TagResourceRequest): TagResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new TagResourceHeaders{};
  return tagResourceWithOptions(request, headers, runtime);
}

model UntagResourceHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the function is invoked. The value is in the **EEE,d MMM yyyy HH:mm:ss GMT** format.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='my-test-trace-id'),
}

model UntagResourceRequest {
  all?: boolean(name='all', description='Specifies whether to remove all tags. This parameter takes effect only when no tag key is specified. Valid values:

*   **true**
*   **false**', example='false'),
  resourceArn?: string(name='resourceArn', description='The Alibaba Cloud Resource Name (ARN) of the resource.

> You can use the value of this parameter to query the information about the resource, such as the account, service, and region information of the resource. You can manage tags only for services for top level resources.', example='acs:fc:cn-shanghai:188077086902****:services/demo'),
  tagKeys?: [ string ](name='tagKeys', description='The keys of the tags that you want to remove.'),
}

model UntagResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
}

async function untagResourceWithOptions(request: UntagResourceRequest, headers: UntagResourceHeaders, runtime: Util.RuntimeOptions): UntagResourceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.all)) {
    body['all'] = request.all;
  }
  if (!Util.isUnset(request.resourceArn)) {
    body['resourceArn'] = request.resourceArn;
  }
  if (!Util.isUnset(request.tagKeys)) {
    body['tagKeys'] = request.tagKeys;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UntagResource',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/tag`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function untagResource(request: UntagResourceRequest): UntagResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new UntagResourceHeaders{};
  return untagResourceWithOptions(request, headers, runtime);
}

model UpdateAliasHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='If the ETag specified in the request matches the ETag value of the object, the object and 200 OK are returned. Otherwise, 412 Precondition Failed is returned.

The ETag value of an object is used to check data integrity of the object. This parameter is empty by default.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time on which the function is invoked. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The trace ID of the invocation request of Function Compute.', example='rid281s******'),
}

model UpdateAliasRequest {
  additionalVersionWeight?: map[string]float(name='additionalVersionWeight', description='The additional version to which the alias points and the weight of the additional version.

*   The additional version takes effect only when the function is invoked.
*   The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.'),
  description?: string(name='description', description='The description of the alias.', example='test_description'),
  resolvePolicy?: string(name='resolvePolicy', description='The canary release mode. Valid values:

*   **Random**: random canary release. This is the default value.
*   **Content**: rule-based canary release.', example='Random'),
  routePolicy?: RoutePolicy(name='routePolicy', description='The canary release rule. Traffic that meets the canary release rule is routed to the canary release instance.'),
  versionId?: string(name='versionId', description='The ID of the version to which the alias points.', example='1'),
}

model UpdateAliasResponseBody = {
  additionalVersionWeight?: map[string]float(name='additionalVersionWeight', description='The additional version to which the alias points and the weight of the additional version.

*   The additional version takes effect only when the function is invoked.
*   The value consists of a version number and a specific weight. For example, 2:0.05 indicates that when a function is invoked, Version 2 is the canary release version, 5% of the traffic is distributed to the canary release version, and 95% of the traffic is distributed to the major version.'),
  aliasName?: string(name='aliasName', description='The name of the alias.', example='test'),
  createdTime?: string(name='createdTime', description='The time when the alias was created.', example='2016-08-15T16:06:05.000+0000'),
  description?: string(name='description', description='The description of the alias.', example='test_description'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the alias was last modified.', example='2016-08-15T16:06:05.000+0000'),
  resolvePolicy?: string(name='resolvePolicy'),
  routePolicy?: RoutePolicy(name='routePolicy'),
  versionId?: string(name='versionId', description='The ID of the version to which the alias points.', example='1'),
}

model UpdateAliasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAliasResponseBody(name='body'),
}

async function updateAliasWithOptions(serviceName: string, aliasName: string, request: UpdateAliasRequest, headers: UpdateAliasHeaders, runtime: Util.RuntimeOptions): UpdateAliasResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.additionalVersionWeight)) {
    body['additionalVersionWeight'] = request.additionalVersionWeight;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.resolvePolicy)) {
    body['resolvePolicy'] = request.resolvePolicy;
  }
  if (!Util.isUnset(request.routePolicy)) {
    body['routePolicy'] = request.routePolicy;
  }
  if (!Util.isUnset(request.versionId)) {
    body['versionId'] = request.versionId;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAlias',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/aliases/${OpenApiUtil.getEncodeParam(aliasName)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateAlias(serviceName: string, aliasName: string, request: UpdateAliasRequest): UpdateAliasResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new UpdateAliasHeaders{};
  return updateAliasWithOptions(serviceName, aliasName, request, headers, runtime);
}

model UpdateCustomDomainHeaders {
  commonHeaders?: map[string]string,
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the operation is called. The format is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='asdf*****'),
}

model UpdateCustomDomainRequest {
  certConfig?: CertConfig(name='certConfig', description='The configuration of the HTTPS certificate.'),
  protocol?: string(name='protocol', description='The protocol types supported by the domain name. Valid values:

*   **HTTP**: Only HTTP is supported.
*   **HTTPS**: Only HTTPS is supported.
*   **HTTP,HTTPS**: Both HTTP and HTTPS are supported.', example='HTTP'),
  routeConfig?: RouteConfig(name='routeConfig', description='The configuration of the route table. The route table maps paths to functions when the functions are invoked by using custom domain names.'),
  tlsConfig?: TLSConfig(name='tlsConfig', description='The TLS configurations.'),
  wafConfig?: WAFConfig(name='wafConfig', description='Web Application Firewall (WAF) configurations.'),
}

model UpdateCustomDomainResponseBody = {
  accountId?: string(name='accountId', description='The ID of your Alibaba Cloud account.', example='1986114****4305'),
  apiVersion?: string(name='apiVersion', description='The version of the API.', example='2016-08-15'),
  certConfig?: CertConfig(name='certConfig', description='The configuration of the HTTPS certificate.'),
  createdTime?: string(name='createdTime', description='The time when the custom domain name was created.', example='2020-07-27T08:02:19Z'),
  domainName?: string(name='domainName', description='The domain name.', example='example.com'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the domain name was last modified.', example='2020-07-27T08:02:19Z'),
  protocol?: string(name='protocol', description='The protocol type that is supported by the custom domain name.

*   **HTTP**: Only HTTP is supported.
*   **HTTPS**: Only HTTPS is supported.
*   **HTTP,HTTPS**: HTTP and HTTPS are supported.', example='HTTP'),
  routeConfig?: RouteConfig(name='routeConfig', description='The configuration of the route table. The route table maps paths to functions when the functions are invoked by using custom domain names.'),
  tlsConfig?: TLSConfig(name='tlsConfig', description='The TLS configurations.'),
  wafConfig?: WAFConfig(name='wafConfig', description='Web Application Firewall (WAF) configurations.'),
}

model UpdateCustomDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateCustomDomainResponseBody(name='body'),
}

async function updateCustomDomainWithOptions(domainName: string, request: UpdateCustomDomainRequest, headers: UpdateCustomDomainHeaders, runtime: Util.RuntimeOptions): UpdateCustomDomainResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.certConfig)) {
    body['certConfig'] = request.certConfig;
  }
  if (!Util.isUnset(request.protocol)) {
    body['protocol'] = request.protocol;
  }
  if (!Util.isUnset(request.routeConfig)) {
    body['routeConfig'] = request.routeConfig;
  }
  if (!Util.isUnset(request.tlsConfig)) {
    body['tlsConfig'] = request.tlsConfig;
  }
  if (!Util.isUnset(request.wafConfig)) {
    body['wafConfig'] = request.wafConfig;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateCustomDomain',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/custom-domains/${OpenApiUtil.getEncodeParam(domainName)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateCustomDomain(domainName: string, request: UpdateCustomDomainRequest): UpdateCustomDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new UpdateCustomDomainHeaders{};
  return updateCustomDomainWithOptions(domainName, request, headers, runtime);
}

model UpdateFunctionHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', example='188077086902****'),
  xFcCodeChecksum?: string(name='X-Fc-Code-Checksum', example='1506052139770049xxxx'),
  xFcDate?: string(name='X-Fc-Date', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', example='test-trace-id'),
}

model UpdateFunctionRequest {
  instanceConcurrency?: int32(name='InstanceConcurrency', description='The number of requests that can be concurrently processed by a single instance.', example='10'),
  caPort?: int32(name='caPort', description='The port on which the HTTP server listens for the custom runtime or custom container runtime.', example='9000'),
  code?: Code(name='code', description='The packaged code of the function. **Function code packages** can be provided with the following two methods. You must use only one of the methods in a request.

*   Specify the name of the Object Storage Service (OSS) bucket and object where the code package is stored. The names are specified in the **ossBucketName** and **ossObjectName** parameters.
*   Specify the Base64-encoded content of the ZIP file by using the **zipFile** parameter.'),
  cpu?: float(name='cpu', description='The number of vCPUs of the function. The value is a multiple of 0.05.', example='1.5'),
  customContainerConfig?: CustomContainerConfig(name='customContainerConfig', description='The configuration of the custom container. After you configure the custom container, Function Compute can execute the function in a container created from a custom image.'),
  customDNS?: CustomDNS(name='customDNS', description='The custom DNS configurations of the function.'),
  customHealthCheckConfig?: CustomHealthCheckConfig(name='customHealthCheckConfig', description='The custom health check configuration of the function. This parameter is applicable only to custom runtimes and custom containers.'),
  customRuntimeConfig?: CustomRuntimeConfig(name='customRuntimeConfig', description='The configurations of the custom runtime for the function.'),
  description?: string(name='description', description='The description of the function.', example='test desc'),
  diskSize?: int32(name='diskSize', description='The disk size of the function. Unit: MB. Valid values: 512 and 10240.', example='512'),
  environmentVariables?: map[string]string(name='environmentVariables', description='The environment variables that are configured for the function. You can obtain the values of the environment variables from the function. For more information, see [Environment variables](~~69777~~).'),
  gpuMemorySize?: int32(name='gpuMemorySize', description='The GPU memory capacity for the function. Unit: MB. The value is a multiple of 1,024.', example='2048'),
  handler?: string(name='handler', description='The handler of the function. The format varies based on the programming language. For more information, see [Function handlers](~~157704~~).', example='index.handler'),
  initializationTimeout?: int32(name='initializationTimeout', description='The timeout period for the execution of the Initializer hook. Unit: seconds. Default value: 3. Minimum value: 1. When the period ends, the execution of the Initializer hook is terminated.', example='60'),
  initializer?: string(name='initializer', description='The handler of the Initializer hook. The format is determined by the programming language. For more information, see [Function handlers](~~157704~~).', example='index.handler'),
  instanceLifecycleConfig?: InstanceLifecycleConfig(name='instanceLifecycleConfig', description='The lifecycle configurations of the instance.'),
  instanceSoftConcurrency?: int32(name='instanceSoftConcurrency', description='The soft concurrency of the instance. You can use this property to implement graceful scale-ups for instances. If the number of concurrent requests on an instance is greater than the soft concurrency value of the instance, an instance scale-up is triggered. For example, if your instance requires a long time to start, you can specify a suitable soft concurrency to start the instance in advance.

The value must be less than or equal to that of the **instanceConcurrency** parameter.', example='5'),
  instanceType?: string(name='instanceType', description='The instance type of the function. Valid values:

*   **e1**: elastic instance
*   **c1**: performance instance
*   **fc.gpu.tesla.1**: GPU-accelerated instance (Tesla T4)
*   **fc.gpu.ampere.1**: GPU-accelerated instance (Ampere A10)
*   **g1**: same as **fc.gpu.tesla.1**', example='e1'),
  layers?: [ string ](name='layers', description='An array that consists of the information of layers.

> Multiple layers are merged based on the order of array subscripts. The content of a layer with a smaller subscript overwrites the file that has the same name as a layer with a larger subscript.'),
  memorySize?: int32(name='memorySize', description='The memory size for the function. Unit: MB. The value must be a multiple of 64. The memory size varies based on the function instance type. For more information, see [Instance types](~~179379~~).', example='512'),
  runtime?: string(name='runtime', description='The runtime environment of the function. Valid values: **nodejs16**, **nodejs14**, **nodejs12**, **nodejs10**, **nodejs8**, **nodejs6**, **nodejs4.4**, **python3.10**, **python3.9**, **python3**, **python2.7**, **java11**, **java8**, **go1**, **php7.2**, **dotnetcore3.1**, **dotnetcore2.1**, **custom.debian10**, **custom**, and **custom-container**. For more information, see [Supported function runtime environments](~~73338~~).', example='python3.9'),
  timeout?: int32(name='timeout', description='The timeout period for the execution of the function. Unit: seconds. Default value: 3. Minimum value: 1. When the period ends, the execution of the function is terminated.', example='60'),
}

model UpdateFunctionResponseBody = {
  caPort?: int32(name='caPort', example='9000'),
  codeChecksum?: string(name='codeChecksum', example='5434025278388143772'),
  codeSize?: long(name='codeSize', example='1024'),
  cpu?: float(name='cpu', example='1.5'),
  createdTime?: string(name='createdTime', example='2016-08-15T15:00:00.000+0000'),
  customContainerConfig?: CustomContainerConfig(name='customContainerConfig'),
  customDNS?: CustomDNS(name='customDNS'),
  customHealthCheckConfig?: CustomHealthCheckConfig(name='customHealthCheckConfig'),
  customRuntimeConfig?: CustomRuntimeConfig(name='customRuntimeConfig'),
  description?: string(name='description', example='This is a demo hello world function'),
  diskSize?: int32(name='diskSize', example='512'),
  environmentVariables?: map[string]string(name='environmentVariables'),
  functionId?: string(name='functionId', example='2d28e0e9-9ba5-4eed-8b1a-d3d9cd24****'),
  functionName?: string(name='functionName', example='demo-function'),
  gpuMemorySize?: int32(name='gpuMemorySize', example='2048'),
  handler?: string(name='handler', example='index.handler'),
  initializationTimeout?: int32(name='initializationTimeout', example='60'),
  initializer?: string(name='initializer', example='index.handler'),
  instanceConcurrency?: int32(name='instanceConcurrency', example='10'),
  instanceLifecycleConfig?: InstanceLifecycleConfig(name='instanceLifecycleConfig'),
  instanceSoftConcurrency?: int32(name='instanceSoftConcurrency', example='5'),
  instanceType?: string(name='instanceType', example='e1'),
  lastModifiedTime?: string(name='lastModifiedTime', example='2016-08-15T17:00:00.000+0000'),
  layers?: [ string ](name='layers', description='The layers.

>  Multiple layers are merged based on the order of array subscripts. The content of a layer with a smaller subscript overwrites the file that has the same name of a layer with a larger subscript.'),
  layersArnV2?: [ string ](name='layersArnV2', description='A list of layer ARNs.'),
  memorySize?: int32(name='memorySize', example='512'),
  runtime?: string(name='runtime', description='The runtime environment of the function. Valid values: **nodejs16**, **nodejs14**, **nodejs12**, **nodejs10**, **nodejs8**, **nodejs6**, **nodejs4.4**, **python3.10**, **python3.9**, **python3**, **python2.7**, **java11**, **java8**, **go1**, **php7.2**, **dotnetcore3.1**, **dotnetcore2.1**, **custom.debian10**, **custom**, and **custom-container**. For more information, see [Supported function runtime environments](~~73338~~).', example='python3.9'),
  timeout?: int32(name='timeout', example='10'),
}

model UpdateFunctionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateFunctionResponseBody(name='body'),
}

async function updateFunctionWithOptions(serviceName: string, functionName: string, request: UpdateFunctionRequest, headers: UpdateFunctionHeaders, runtime: Util.RuntimeOptions): UpdateFunctionResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceConcurrency)) {
    body['InstanceConcurrency'] = request.instanceConcurrency;
  }
  if (!Util.isUnset(request.caPort)) {
    body['caPort'] = request.caPort;
  }
  if (!Util.isUnset(request.code)) {
    body['code'] = request.code;
  }
  if (!Util.isUnset(request.cpu)) {
    body['cpu'] = request.cpu;
  }
  if (!Util.isUnset(request.customContainerConfig)) {
    body['customContainerConfig'] = request.customContainerConfig;
  }
  if (!Util.isUnset(request.customDNS)) {
    body['customDNS'] = request.customDNS;
  }
  if (!Util.isUnset(request.customHealthCheckConfig)) {
    body['customHealthCheckConfig'] = request.customHealthCheckConfig;
  }
  if (!Util.isUnset(request.customRuntimeConfig)) {
    body['customRuntimeConfig'] = request.customRuntimeConfig;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.diskSize)) {
    body['diskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.environmentVariables)) {
    body['environmentVariables'] = request.environmentVariables;
  }
  if (!Util.isUnset(request.gpuMemorySize)) {
    body['gpuMemorySize'] = request.gpuMemorySize;
  }
  if (!Util.isUnset(request.handler)) {
    body['handler'] = request.handler;
  }
  if (!Util.isUnset(request.initializationTimeout)) {
    body['initializationTimeout'] = request.initializationTimeout;
  }
  if (!Util.isUnset(request.initializer)) {
    body['initializer'] = request.initializer;
  }
  if (!Util.isUnset(request.instanceLifecycleConfig)) {
    body['instanceLifecycleConfig'] = request.instanceLifecycleConfig;
  }
  if (!Util.isUnset(request.instanceSoftConcurrency)) {
    body['instanceSoftConcurrency'] = request.instanceSoftConcurrency;
  }
  if (!Util.isUnset(request.instanceType)) {
    body['instanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.layers)) {
    body['layers'] = request.layers;
  }
  if (!Util.isUnset(request.memorySize)) {
    body['memorySize'] = request.memorySize;
  }
  if (!Util.isUnset(request.runtime)) {
    body['runtime'] = request.runtime;
  }
  if (!Util.isUnset(request.timeout)) {
    body['timeout'] = request.timeout;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcCodeChecksum)) {
    realHeaders['X-Fc-Code-Checksum'] = Util.toJSONString(headers.xFcCodeChecksum);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateFunction',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateFunction(serviceName: string, functionName: string, request: UpdateFunctionRequest): UpdateFunctionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new UpdateFunctionHeaders{};
  return updateFunctionWithOptions(serviceName, functionName, request, headers, runtime);
}

model UpdateServiceHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='The value used to ensure that the modified service is consistent with the service to be modified. The value is obtained from the responses of the [CreateService](~~175256~~), [UpdateService](~~188167~~), and [GetService](~~189225~~) operations.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the Function Compute API is called. The format is **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='rid281s******'),
}

model UpdateServiceRequest {
  description?: string(name='description', description='The description of the service.', example='test service'),
  internetAccess?: boolean(name='internetAccess', description='Specifies whether to allow functions to access the Internet. Valid values:

*   **true**: allows functions in the specified service to access the Internet.
*   **false**: does not allow functions to access the Internet.', example='true'),
  logConfig?: LogConfig(name='logConfig', description='The log configuration. Function Compute writes function execution logs to the specified Logstore.'),
  nasConfig?: NASConfig(name='nasConfig', description='The configurations of the NAS file system. The configurations allow functions to access the specified NAS resources.'),
  ossMountConfig?: OSSMountConfig(name='ossMountConfig', description='The OSS mount configurations.'),
  role?: string(name='role', description='The RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:

*   Sends function execution logs to your Logstore.
*   Generates a token for a function to access other cloud resources during function execution.', example='acs:ram::1234567890:role/fc-test'),
  tracingConfig?: TracingConfig(name='tracingConfig', description='The configurations of Tracing Analysis. After you configure Tracing Analysis for a service in Function Compute, you can record the execution duration of a request, view the amount of cold start time for a function, and record the execution duration of a function. For more information, see [Overview](~~189804~~).'),
  vpcConfig?: VPCConfig(name='vpcConfig', description='The virtual private cloud (VPC) configuration, which allows functions in the specified service in Function Compute to access the specified VPC.'),
}

model UpdateServiceResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the service was created.', example='2016-08-15T16:06:05.000+0000'),
  description?: string(name='description', description='The description of the service.', example='test_description'),
  internetAccess?: boolean(name='internetAccess', description='Specifies whether to allow functions to access the Internet. Valid values:

*   **true**: allows functions in the specified service to access the Internet.
*   **false**: does not allow functions to access the Internet.', example='true'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The time when the service was last modified.', example='2016-08-15T16:06:05.000+0000'),
  logConfig?: LogConfig(name='logConfig', description='The log configuration, which specifies a Logstore to store function execution logs.'),
  nasConfig?: NASConfig(name='nasConfig', description='The configurations of the NAS file system. The configuration allows functions in the specified service in Function Compute to access the NAS file system.'),
  ossMountConfig?: OSSMountConfig(name='ossMountConfig', description='The OSS mount configurations.'),
  role?: string(name='role', description='The RAM role that is used to grant required permissions to Function Compute. The RAM role is used in the following scenarios:

*   Sends function execution logs to your Logstore.
*   Generates a token for a function to access other cloud resources during function execution.', example='acs:ram::1234567890:role/fc-test'),
  serviceId?: string(name='serviceId', description='The unique ID generated by the system for the service.', example='2d28e0e9-9ba5-4eed-8b1a-d3d9cd24e737'),
  serviceName?: string(name='serviceName', description='The name of the service.', example='demo-service'),
  tracingConfig?: TracingConfig(name='tracingConfig', description='The configuration of Tracing Analysis. After you configure Tracing Analysis for a service in Function Compute, you can record the execution duration of a request, view the amount of cold start time for a function, and record the execution duration of a function. For more information, see [Overview](~~189804~~).'),
  useSLRAuthentication?: boolean(name='useSLRAuthentication'),
  vpcConfig?: VPCConfig(name='vpcConfig', description='The VPC configuration. The configuration allows a function to access the specified VPC.'),
}

model UpdateServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateServiceResponseBody(name='body'),
}

async function updateServiceWithOptions(serviceName: string, request: UpdateServiceRequest, headers: UpdateServiceHeaders, runtime: Util.RuntimeOptions): UpdateServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.internetAccess)) {
    body['internetAccess'] = request.internetAccess;
  }
  if (!Util.isUnset(request.logConfig)) {
    body['logConfig'] = request.logConfig;
  }
  if (!Util.isUnset(request.nasConfig)) {
    body['nasConfig'] = request.nasConfig;
  }
  if (!Util.isUnset(request.ossMountConfig)) {
    body['ossMountConfig'] = request.ossMountConfig;
  }
  if (!Util.isUnset(request.role)) {
    body['role'] = request.role;
  }
  if (!Util.isUnset(request.tracingConfig)) {
    body['tracingConfig'] = request.tracingConfig;
  }
  if (!Util.isUnset(request.vpcConfig)) {
    body['vpcConfig'] = request.vpcConfig;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateService',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateService(serviceName: string, request: UpdateServiceRequest): UpdateServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new UpdateServiceHeaders{};
  return updateServiceWithOptions(serviceName, request, headers, runtime);
}

model UpdateTriggerHeaders {
  commonHeaders?: map[string]string,
  ifMatch?: string(name='If-Match', description='This parameter is used to ensure that the modified resource is consistent with the resource to be modified. You can obtain the parameter value from the responses of [CreateTrigger](~~190054~~), [GetTrigger](~~190056~~), and [UpdateTrigger](~~190055~~) operations.', example='e19d5cd5af0378da05f63f891c7467af'),
  xFcAccountId?: string(name='X-Fc-Account-Id', description='The ID of your Alibaba Cloud account.', example='188077086902****'),
  xFcDate?: string(name='X-Fc-Date', description='The time when the request is initiated on the client. The format of the value is: **EEE,d MMM yyyy HH:mm:ss GMT**.', example='Wed, 11 May 2022 09:00:00 GMT'),
  xFcTraceId?: string(name='X-Fc-Trace-Id', description='The custom request ID.', example='my-test-trace-id'),
}

model UpdateTriggerRequest {
  description?: string(name='description', description='The description of the trigger.', example='trigger for test'),
  invocationRole?: string(name='invocationRole', description='The role that is used by the event source such as Object Storage Service (OSS) to invoke the function. For more information, see [Overview](~~53102~~).', example='acs:ram::123456xxxx:role/fc-test'),
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
  triggerConfig?: string(name='triggerConfig', description='The configurations of the trigger. The configurations vary based on the trigger type. For more information about the format, see the following topics:

*   Object Storage Service (OSS) trigger: [OSSTriggerConfig](~~415697~~).
*   Simple Log Service trigger: [LogTriggerConfig](~~415694~~).
*   Time trigger: [TimeTriggerConfig](~~415712~~).
*   HTTP trigger: [HTTPTriggerConfig](~~415685~~).
*   Tablestore trigger: Specify the **SourceArn** parameter and leave this parameter empty.
*   Alibaba Cloud CDN event trigger: [CDNEventsTriggerConfig](~~415674~~).
*   MNS topic trigger: [MnsTopicTriggerConfig](~~415695~~).
*   EventBridge triggers: [EventBridgeTriggerConfig](~~2508622~~).', example='{"events": ["oss:ObjectCreated:*"], "filter": {"key": {"prefix": "/prefix", "suffix": ".zip"}}}'),
}

model UpdateTriggerResponseBody = {
  createdTime?: string(name='createdTime', description='The time when the audio or video file was created.', example='2016-08-15T15:00:00.000+0000'),
  description?: string(name='description', description='The description of the trigger.', example='trigger for test'),
  domainName?: string(name='domainName', description='The domain name used to invoke the function by using HTTP. You can add this domain name as the prefix to the endpoint of Function Compute. This way, you can invoke the function that corresponds to the trigger by using HTTP. For example, `{domainName}.cn-shanghai.fc.aliyuncs.com`.', example='demo-service-demo-function-jkhksh'),
  invocationRole?: string(name='invocationRole', description='The ARN of the RAM role that is used by the event source to invoke the function.', example='acs:ram::123456xxxx:role/fc-test'),
  lastModifiedTime?: string(name='lastModifiedTime', description='The last modification time.', example='016-08-15T17:00:00.000+0000'),
  qualifier?: string(name='qualifier', description='The version or alias of the service.', example='LATEST'),
  sourceArn?: string(name='sourceArn', description='The ARN of the event source.', example='acs:oss:cn-shanghai:12345xxxx:mybucket'),
  status?: string(name='status', description='The current state of the trigger. This parameter is valid only for EventBridge-based triggers.', example='RUNNING'),
  targetArn?: string(name='targetArn', description='The Alibaba Cloud Resource Name (ARN) of the function associated with the trigger.', example='acs:fc::123456xxxx:services/my-test-service.LATEST/functions/my-test-function'),
  triggerConfig?: string(name='triggerConfig', description='The configurations of the trigger. The configurations vary based on the trigger type.', example='{"events": ["oss:ObjectCreated:*"], "filter": {"key": {"prefix": "/prefix", "suffix": ".zip"}}}'),
  triggerId?: string(name='triggerId', description='The unique ID of the trigger.', example='3e270f2f-cef2-421a-bc86-ff4e8088****'),
  triggerName?: string(name='triggerName', description='The name of the trigger.', example='demoTrigger'),
  triggerType?: string(name='triggerType', description='The trigger type. Example values: **oss**, **log**, **tablestore**, **timer**, **http**, **cdn_events**, **mns_topic**, and **eventbridge**.', example='oss'),
  urlInternet?: string(name='urlInternet', description='The public domain address. You can access HTTP triggers over the Internet by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou.fcapp.run'),
  urlIntranet?: string(name='urlIntranet', description='The private endpoint. In a VPC, you can access HTTP triggers by using HTTP or HTTPS.', example='https://svc-func-xxxxxxxx.cn-hangzhou-vpc.fcapp.run'),
}

model UpdateTriggerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTriggerResponseBody(name='body'),
}

async function updateTriggerWithOptions(serviceName: string, functionName: string, triggerName: string, request: UpdateTriggerRequest, headers: UpdateTriggerHeaders, runtime: Util.RuntimeOptions): UpdateTriggerResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.invocationRole)) {
    body['invocationRole'] = request.invocationRole;
  }
  if (!Util.isUnset(request.qualifier)) {
    body['qualifier'] = request.qualifier;
  }
  if (!Util.isUnset(request.triggerConfig)) {
    body['triggerConfig'] = request.triggerConfig;
  }

  var realHeaders : map[string]string = {};
  if (!Util.isUnset(headers.commonHeaders)) {
    realHeaders = headers.commonHeaders;
  }
  if (!Util.isUnset(headers.ifMatch)) {
    realHeaders['If-Match'] = Util.toJSONString(headers.ifMatch);
  }
  if (!Util.isUnset(headers.xFcAccountId)) {
    realHeaders['X-Fc-Account-Id'] = Util.toJSONString(headers.xFcAccountId);
  }
  if (!Util.isUnset(headers.xFcDate)) {
    realHeaders['X-Fc-Date'] = Util.toJSONString(headers.xFcDate);
  }
  if (!Util.isUnset(headers.xFcTraceId)) {
    realHeaders['X-Fc-Trace-Id'] = Util.toJSONString(headers.xFcTraceId);
  }
  var req = new OpenApi.OpenApiRequest{ 
    headers = realHeaders,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTrigger',
    version = '2021-04-06',
    protocol = 'HTTPS',
    pathname = `/2021-04-06/services/${OpenApiUtil.getEncodeParam(serviceName)}/functions/${OpenApiUtil.getEncodeParam(functionName)}/triggers/${OpenApiUtil.getEncodeParam(triggerName)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateTrigger(serviceName: string, functionName: string, triggerName: string, request: UpdateTriggerRequest): UpdateTriggerResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers = new UpdateTriggerHeaders{};
  return updateTriggerWithOptions(serviceName, functionName, triggerName, request, headers, runtime);
}

